Just added the situation an returncode was raised but no content is in stderr

This commit is contained in:
Thomas-Karl Pietrowski 2015-01-23 16:56:41 +01:00
parent 0ab5d1b65e
commit 9ff8cbccc7
1 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,9 @@ def getoutput(cmd):
p.wait()
if p.returncode: # if not returncode == 0
print('WARNING: A problem occured while running {0} (code {1})\n'.format(cmd,p.returncode))
print('{0}'.format(p.stderr.read()))
stderr_content = p.stderr.read()
if stderr_content:
print('{0}\n'.format(stderr_content))
return ""
return p.stdout.read()