Commit 5f46db69 authored by Łukasz Nowak's avatar Łukasz Nowak

promise/plugin: Use check_output instead of hand crafting

parent b1bc3918
...@@ -22,13 +22,14 @@ class RunPromise(GenericPromise): ...@@ -22,13 +22,14 @@ class RunPromise(GenericPromise):
command = self.getConfig('command') command = self.getConfig('command')
try: try:
process = subprocess.Popen( out = subprocess.check_output(
command, command,
shell=True, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
out, _ = process.communicate() status = 0
status = process.returncode except subprocess.CalledProcessError as e:
out = e.output
status = e.returncode
except Exception as e: except Exception as e:
self.logger.error( self.logger.error(
"ERROR %r during running command %r" % (e, command)) "ERROR %r during running command %r" % (e, command))
......
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