Fix shellexec
This commit is contained in:
@@ -54,9 +54,8 @@ class WOShellExec():
|
|||||||
def cmd_exec_stdout(self, command, errormsg='', log=True):
|
def cmd_exec_stdout(self, command, errormsg='', log=True):
|
||||||
"""Run shell command from Python"""
|
"""Run shell command from Python"""
|
||||||
try:
|
try:
|
||||||
log and Log.debug(self, "Running command: command -v {0}".format(command))
|
log and Log.debug(self, "Running command: {0}".format(command))
|
||||||
check_command = 'command -v' + command
|
with subprocess.Popen([command], stdout=subprocess.PIPE,
|
||||||
with subprocess.Popen([check_command], stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE, shell=True) as proc:
|
stderr=subprocess.PIPE, shell=True) as proc:
|
||||||
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
|
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
|
||||||
(cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8',
|
(cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8',
|
||||||
|
|||||||
Reference in New Issue
Block a user