Skip to content

Conversation

@langong347
Copy link

@langong347 langong347 commented Oct 21, 2025

Improved run_shell_command() to capture stdout and stderr when in quiet mode instead of suppressing them. This ensures errors and warnings are always visible for debugging.

Example usage: stack-pr submit returned with exit 1 due to an outdated version of gh.

$ stack-pr submit

Adding cross-links to PRs
# stdout and stderr captured and printed to console by exception handling
Exitcode: 1
Stdout: None
Stderr: GraphQL: Projects (classic) is being deprecated in favor of the new Projects experience, see: https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/. (repository.pullRequest.projectCards)

# Tracestack printed as usual
subprocess.CalledProcessError: Command '['gh', 'pr', 'edit', 'https://github.com/modularml/modular/pull/70936', '-t', 'Test GH', '-F', '-', '-B', 'main']' returned non-zero exit status 1.

Test plan

pytest tests/test_shell_commands.py -v

Example usage: `stack-pr submit` returned with exit 1 due to an outdated version of `gh`.

```
$ stack-pr submit

Adding cross-links to PRs
Exitcode: 1
Stdout: None
Stderr: GraphQL: Projects (classic) is being deprecated in favor of the new Projects experience, see: https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/. (repository.pullRequest.projectCards)

subprocess.CalledProcessError: Command '['gh', 'pr', 'edit', 'modularml/modular#70936', '-t', 'Test GH', '-F', '-', '-B', 'main']' returned non-zero exit status 1.
```

Test Plan:

```
python -m pytest tests/test_shell_commands.py -v
```
@langong347 langong347 force-pushed the lang/print_stderrout branch from c4fcdb2 to 819482d Compare October 22, 2025 17:01
@langong347 langong347 changed the title Print stdout stderr when running shell commands Capture stdout stderr when running shell commands in quiet mode Oct 22, 2025
Copy link
Contributor

@dukebw dukebw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@langong347
Copy link
Author

@zbowling @ZolotukhinM May I get your approval for this PR? Thanks.

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.

3 participants