This commit is contained in:
Miroslav Stampar
2019-05-13 11:08:25 +02:00
parent c4f09a8e8a
commit 10be8a12bd
5 changed files with 22 additions and 12 deletions

View File

@@ -2151,14 +2151,20 @@ def shellExec(cmd):
"""
Executes arbitrary shell command
>>> shellExec('echo 1').strip() == b'1'
>>> shellExec('echo 1').strip() == '1'
True
"""
retVal = ""
try:
return subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0] or ""
retVal = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0] or ""
except Exception as ex:
return six.text_type(ex)
retVal = getSafeExString(ex)
finally:
retVal = getText(retVal)
return retVal
def clearConsoleLine(forceOutput=False):
"""