Skip to content

Commit

Permalink
Fixed subprocess output getting printed on editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
richrd committed Jan 27, 2016
1 parent 23be798 commit a3940a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion suplemon/modules/battery.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- encoding: utf-8

import os
import time
import subprocess

Expand Down Expand Up @@ -71,7 +72,8 @@ def battery_status_read(self):
def battery_status_acpi(self):
"""Get the battery status via acpi."""
try:
raw_str = subprocess.check_output(["acpi"])
FNULL = open(os.devnull, 'w')
raw_str = subprocess.check_output(["acpi"], stdout=FNULL, stderr=FNULL)
except:
return None
raw_str = raw_str.decode("utf-8")
Expand All @@ -91,6 +93,7 @@ def battery_status_upower(self):
except:
return None
raw_str = raw_str.decode("utf-8")
raw_str = raw_str.splitlines()[0]
part = helpers.get_string_between("percentage:", "%", raw_str)
if part:
try:
Expand Down

0 comments on commit a3940a1

Please sign in to comment.