libzypp
17.14.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ShutdownLock.cc
Go to the documentation of this file.
1
#include "
ShutdownLock_p.h
"
2
3
#include "
zypp/ExternalProgram.h
"
4
#include <iostream>
5
6
zypp::ShutdownLock::ShutdownLock
(
const
std::string &reason)
7
{
8
try
{
9
10
std::string whyStr =
str::form
(
"--why=%s"
, reason.c_str());
11
12
const
char
* argv[] =
13
{
14
"/usr/bin/systemd-inhibit"
,
15
"--what=sleep:shutdown:idle"
,
16
"--who=zypp"
,
17
"--mode=block"
,
18
whyStr.c_str(),
19
"/usr/bin/cat"
,
20
NULL
21
};
22
_prog
= shared_ptr<ExternalProgramWithSeperatePgid>(
new
ExternalProgramWithSeperatePgid
( argv,
ExternalProgram::Discard_Stderr
) );
23
}
catch
(...) {
24
}
25
}
26
27
zypp::ShutdownLock::~ShutdownLock
()
28
{
29
if
(
_prog
) {
30
_prog
->
kill
();
31
}
32
}
zypp
ShutdownLock.cc
Generated by
1.8.2