Commit a8476989 authored by louiz’'s avatar louiz’

fix get_output_of_command. fixed #2018

parent 7c531eee
...@@ -40,10 +40,7 @@ import hashlib ...@@ -40,10 +40,7 @@ import hashlib
import subprocess import subprocess
import curses import curses
import sys import sys
import select
import errno
import time import time
import traceback
ROOM_STATE_NONE = 11 ROOM_STATE_NONE = 11
ROOM_STATE_CURRENT = 10 ROOM_STATE_CURRENT = 10
...@@ -72,16 +69,10 @@ def get_output_of_command(command): ...@@ -72,16 +69,10 @@ def get_output_of_command(command):
Runs a command and returns its output Runs a command and returns its output
""" """
try: try:
child_stdin, child_stdout = os.popen2(command) return subprocess.check_output(command.split()).decode('utf-8').split('\n')
except ValueError: except subprocess.CalledProcessError:
return None return None
output = child_stdout.readlines()
child_stdout.close()
child_stdin.close()
return output
def is_in_path(command, return_abs_path=False): def is_in_path(command, return_abs_path=False):
""" """
Return True if 'command' is found in one of the directories in the user's Return True if 'command' is found in one of the directories in the user's
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment