summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-01-22 15:03:54 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-01-22 15:03:54 +0100
commita84769890b266eaab5f209f595361bd9ee9c241b (patch)
tree0dc7fae2d107969e74d0817a9efac57574b3917d
parent7c531eeec1b22407eff99ae014dd65263963b80a (diff)
downloadpoezio-a84769890b266eaab5f209f595361bd9ee9c241b.tar.gz
poezio-a84769890b266eaab5f209f595361bd9ee9c241b.tar.bz2
poezio-a84769890b266eaab5f209f595361bd9ee9c241b.tar.xz
poezio-a84769890b266eaab5f209f595361bd9ee9c241b.zip
fix get_output_of_command. fixed #2018
-rw-r--r--src/common.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/common.py b/src/common.py
index b909977c..141b67be 100644
--- a/src/common.py
+++ b/src/common.py
@@ -40,10 +40,7 @@ import hashlib
import subprocess
import curses
import sys
-import select
-import errno
import time
-import traceback
ROOM_STATE_NONE = 11
ROOM_STATE_CURRENT = 10
@@ -72,16 +69,10 @@ def get_output_of_command(command):
Runs a command and returns its output
"""
try:
- child_stdin, child_stdout = os.popen2(command)
- except ValueError:
+ return subprocess.check_output(command.split()).decode('utf-8').split('\n')
+ except subprocess.CalledProcessError:
return None
- output = child_stdout.readlines()
- child_stdout.close()
- child_stdin.close()
-
- return output
-
def is_in_path(command, return_abs_path=False):
"""
Return True if 'command' is found in one of the directories in the user's