Skip to content

Always log errors in run_shell_cmd() - #963

Merged
maddenp-cu merged 4 commits into
ufs-community:mainfrom
maddenp-cu:run_shell_cmd-fix
Aug 17, 2026
Merged

Always log errors in run_shell_cmd()#963
maddenp-cu merged 4 commits into
ufs-community:mainfrom
maddenp-cu:run_shell_cmd-fix

Conversation

@maddenp-cu

Copy link
Copy Markdown
Collaborator

Synopsis

Prior to a recent revamp of uwtools.utils.processing.run_shell_cmd(), errors resulting from a failed shell command were always logged, even when quiet=True was specified. The revamp inadvertently (?) changed this, leading to behavior like

$ uw rocoto iterate --cycle 2026-08-17T12 --database rocoto.db --workflow rocoto.xml --task foo
[2026-08-17T17:57:22]     INFO Iterating workflow
$

when the rocoto system module is not loaded such that rocotorun is not available. The error is displayed only if the --verbose flag is specified:

$ uw rocoto iterate --cycle 2026-08-17T12 --database rocoto.db --workflow rocoto.xml --task foo --verbose
[2026-08-17T17:57:47]    DEBUG Command: uw rocoto iterate --cycle 2026-08-17T12 --database rocoto.db --workflow rocoto.xml --task foo --verbose
[2026-08-17T17:57:47]     INFO Iterating workflow
[2026-08-17T17:57:47]    DEBUG Running: rocotorun -d rocoto.db -w rocoto.xml
[2026-08-17T17:57:47]    DEBUG Output:
[2026-08-17T17:57:47]    DEBUG   /bin/sh: line 1: rocotorun: command not found
$

But users should not have to specify --verbose to see an error like this.

This PR updates run_shell_cmd() so that the error behavior above is now

$ uw rocoto iterate --cycle 2026-08-17T12 --database rocoto.db --workflow rocoto.xml --task foo
[2026-08-17T18:29:37]     INFO Iterating workflow
[2026-08-17T18:29:37]    ERROR Failed with status: 127
[2026-08-17T18:29:37]    ERROR Output:
[2026-08-17T18:29:37]    ERROR   /bin/sh: line 1: rocotorun: command not found
$

Type

  • Bug fix (corrects a known issue)

Impact

  • This is a non-breaking change (existing functionality continues to work as expected)

Checklist

  • I have added myself and any co-authors to the PR's Assignees list.
  • I have reviewed the documentation and have made any updates necessitated by this change.
  • Where helpful, I have written comments in this PR's Files changed view to assist reviewers.

@maddenp-cu
maddenp-cu marked this pull request as ready for review August 17, 2026 18:36
@maddenp-cu
maddenp-cu merged commit 7133ffa into ufs-community:main Aug 17, 2026
2 checks passed
@maddenp-cu
maddenp-cu deleted the run_shell_cmd-fix branch August 17, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants