Skip to content

Commit dfe0102

Browse files
committed
Show stderr output on failing command even when not requested to be captured
This helps diagnosing failures for e.g. `eb --missing` (called with `capture_stderr=False`) but which may print errors (e.g. failed parsing of some ECs) to stderr
1 parent 9c4c794 commit dfe0102

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

easybuild/scripts/findPythonDeps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ def run_cmd(arguments, action_desc, capture_stderr=True, **kwargs):
5555
extra_args['universal_newlines'] = True
5656
stderr = subprocess.STDOUT if capture_stderr else subprocess.PIPE
5757
p = subprocess.Popen(arguments, stdout=subprocess.PIPE, stderr=stderr, **extra_args)
58-
out, _ = p.communicate()
58+
out, err = p.communicate()
5959
if p.returncode != 0:
60-
raise RuntimeError('Failed to %s: %s' % (action_desc, out))
60+
if err:
61+
err = "\nSTDERR:\n" + err
62+
raise RuntimeError('Failed to %s: %s%s' % (action_desc, out, err))
6163
return out
6264

6365

0 commit comments

Comments
 (0)