3#include <zypp-core/base/LogTools.h>
4#include <zypp-core/ExternalProgram.h>
11 MIL <<
"Try to acquire an inhibitor lock..." << endl;
12 std::string whoStr =
str::form(
"--who=%s", who.c_str());
13 std::string whyStr =
str::form(
"--why=%s", reason.c_str());
17 "/usr/bin/systemd-inhibit",
18 "--what=sleep:shutdown:idle",
33 MIL <<
"Terminate inhibitor lock: pid " <<
_prog->
getpid() << endl;
35 if ( !
_prog->waitForExit( 10 * 1000 ) ) {
37 WAR <<
"systemd-inhibit did not respond to SIGTERM, killing it" << std::endl;
ExternalProgramWithStderr & _prog
ExternalProgram extended to change the progress group ID after forking.
bool kill()
Kill the program.
int close()
Wait for the progamm to complete.
shared_ptr< ExternalProgramWithSeperatePgid > _prog
ShutdownLock(const std::string &who, const std::string &reason)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.