Skip to content

Commit d5e0a51

Browse files
committed
FIX: Only pass along cmdline if available
1 parent 634afcf commit d5e0a51

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

nipype/pipeline/engine/nodes.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,17 +751,22 @@ def _run_command(self, execute, copyfiles=True):
751751

752752
if exc_tb:
753753
runtime = result.runtime
754+
754755
def _tab(field):
755756
from textwrap import indent
757+
756758
return indent(field, '\t')
757759

758-
raise NodeExecutionError(
759-
f"Exception raised while executing Node {self.name}.\n\n"
760-
f"Cmdline:\n{_tab(runtime.cmdline)}\n"
761-
f"Stdout:\n{_tab(runtime.stdout)}\n"
762-
f"Stderr:\n{_tab(runtime.stderr)}\n"
763-
f"Traceback:\n{_tab(runtime.traceback)}"
764-
)
760+
msg = f"Exception raised while executing Node {self.name}.\n\n"
761+
if hasattr(runtime, 'cmdline'):
762+
msg += (
763+
f"Cmdline:\n{_tab(runtime.cmdline)}\n"
764+
f"Stdout:\n{_tab(runtime.stdout)}\n"
765+
f"Stderr:\n{_tab(runtime.stderr)}\n"
766+
)
767+
# Always pass along the traceback
768+
msg += f"Traceback:\n{_tab(runtime.traceback)}"
769+
raise NodeExecutionError(msg)
765770

766771
return result
767772

0 commit comments

Comments
 (0)