Fix obscured CLI failure messages during redirection#34
Fix obscured CLI failure messages during redirection#34google-labs-jules[bot] wants to merge 2 commits intomainfrom
Conversation
- Modify `ConsoleLogger` to duplicate output to `Console.Error` when `Console.IsOutputRedirected` is true. - Update `RunDotnetAsync` in `cli/Program.cs` to capture all subprocess stdout and dump it to `Console.Error` (and `Console.Out` for markdown) if a command fails and standard logging was suppressed. - Proactively mirror subprocess stdout lines matching error/warning patterns to `Console.Error` when output is redirected. - This ensures that build failures and test results are visible in CI logs even when stdout is redirected to files like `$GITHUB_STEP_SUMMARY`.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| } | ||
|
|
||
| // always!! | ||
| message = message.Replace("\n", $"\n{new string(' ', SR.IndentationAdjustment)}", StringComparison.Ordinal); |
There was a problem hiding this comment.
Update to ConsoleLogger is no longer required.
There was a problem hiding this comment.
Restored ConsoleLogger to its original state as requested.
| } | ||
| }; | ||
|
|
||
| if (requireStdOutLogging) |
There was a problem hiding this comment.
If stdout is redirected, simply, write log to both stdout and stderr without any consideration.
There was a problem hiding this comment.
Updated RunDotnetAsync to always log to both stdout and stderr when redirection is active, regardless of requireStdOutLogging or content (errors/warnings), and removed the redundant buffer dump for this case.
- Restore `ConsoleLogger.cs` to its original state. - Update `cli/Program.cs` to simplify logging during redirection: when `Console.IsOutputRedirected` is true, all subprocess output is now immediately logged to both `Console.Out` and `Console.Error`, regardless of other conditions. - Prevent redundant output buffering/dumping when redirection is already handling the logging.
This change addresses the issue where CLI failures during redirection only show a simple "command failed" message by ensuring that all relevant internal logs and subprocess error details are mirrored to the error stream. Specifically, it modifies the central
ConsoleLoggerto duplicate its output toConsole.Errorwhen redirected and updates the CLI's subprocess runner to capture and selectively dump or mirrorstdouttostderrwhen appropriate.PR created automatically by Jules for task 1337377593457569570 started by @sator-imaging