powertop2tuned: do not crash if powertop is not installed
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
aa30d5e165
commit
9dd7994ca6
2 changed files with 10 additions and 3 deletions
|
|
@ -185,10 +185,16 @@ class PowertopProfile:
|
|||
print "Running PowerTOP, please wait..."
|
||||
environment = os.environ.copy()
|
||||
environment["LC_ALL"] = "C"
|
||||
proc = Popen(["/usr/sbin/powertop", "--html=/tmp/powertop", "--time=1"], stdout=PIPE, stderr=PIPE, env=environment)
|
||||
output = proc.communicate()[1]
|
||||
try:
|
||||
proc = Popen(["/usr/sbin/powertop", "--html=/tmp/powertop", "--time=1"], stdout=PIPE, stderr=PIPE, env=environment)
|
||||
output = proc.communicate()[1]
|
||||
except (OSError, IOError):
|
||||
print >> sys.stderr, 'Unable to execute PowerTOP, is PowerTOP installed?'
|
||||
return -2
|
||||
|
||||
if proc.returncode != 0:
|
||||
return ret
|
||||
print >> sys.stderr, 'PowerTOP returned error code: %d' % proc.returncode
|
||||
return -2
|
||||
|
||||
prefix = "PowerTOP outputing using base filename "
|
||||
if output.find(prefix) == -1:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ network and ATA harddisk devices are implemented.
|
|||
%package utils
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Summary: Various tuned utilities
|
||||
Requires: powertop
|
||||
|
||||
%description utils
|
||||
This package contains utilities that can help you to fine tune your
|
||||
|
|
|
|||
Loading…
Reference in a new issue