1 From: Josep Puigdemont <josep.puigdemont@enea.com>
2 Date: Wed, 4 May 2016 14:27:23 +0200
3 Subject: [PATCH] common.py: catch stderr in exec_cmd
5 Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
7 deploy/common.py | 12 ++++++------
8 1 file changed, 6 insertions(+), 6 deletions(-)
10 diff --git a/deploy/common.py b/deploy/common.py
11 index 787a21a..41b4e27 100644
12 --- a/deploy/common.py
13 +++ b/deploy/common.py
14 @@ -38,20 +38,20 @@ LOG.addHandler(out_handler)
15 os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
17 def exec_cmd(cmd, check=True):
18 - nul_f = open(os.devnull, 'w')
19 process = subprocess.Popen(cmd,
20 stdout=subprocess.PIPE,
22 + stderr=subprocess.PIPE,
25 - response = process.communicate()[0].strip()
26 + (response, stderr) = process.communicate()
27 return_code = process.returncode
28 + response = response.strip()
31 + stderr = stderr.strip()
32 print "Failed command: " + str(cmd)
33 - print "Command returned response: " + str(response)
34 + print "Command returned response: " + str(stderr)
35 print "Command return code: " + str(return_code)
36 - raise Exception(response)
37 + raise Exception(stderr)
39 print "Command: " + str(cmd)