scripts: runner: let users copy/paste failed commands
Print a copy/pastable version of any command which fails, to help
debugging.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
diff --git a/scripts/support/runner/core.py b/scripts/support/runner/core.py
index a38f7b0..8c32cdd 100644
--- a/scripts/support/runner/core.py
+++ b/scripts/support/runner/core.py
@@ -412,7 +412,11 @@
'''
if self.debug:
print(quote_sh_list(cmd))
- subprocess.check_call(cmd)
+ try:
+ subprocess.check_call(cmd)
+ except subprocess.CalledProcessError:
+ print('Error running {}'.format(quote_sh_list(cmd)))
+ raise
def check_output(self, cmd):
'''Subclass subprocess.check_output() wrapper.
@@ -423,7 +427,11 @@
'''
if self.debug:
print(quote_sh_list(cmd))
- return subprocess.check_output(cmd)
+ try:
+ return subprocess.check_output(cmd)
+ except subprocess.CalledProcessError:
+ print('Error running {}'.format(quote_sh_list(cmd)))
+ raise
def popen_ignore_int(self, cmd):
'''Spawn a child command, ensuring it ignores SIGINT.