Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve odebug/SystemCommand debugging output. #16098

Merged
merged 4 commits into from Oct 11, 2023

Conversation

reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Oct 10, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Make odebug always output to stderr so it doesn't break normal output (e.g. when piping --json output).

Also add a new print_stdout: :debug option to SystemCommand which outputs the full command output to stderr when HOMEBREW_DEBUG/--debug is set.

Needed for Homebrew/homebrew-services#595.

@reitermarkus reitermarkus changed the title Odebug system command Improve odebug/SystemCommand debugging output. Oct 10, 2023
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Make odebug always output to stderr so it doesn't break normal output (e.g. when piping --json output).

I think this should be opt-in probably so it's grepable more easily but am open to thoughts from @Homebrew/maintainers if anyone else disagrees.

Also add a new print_stdout: :debug option to SystemCommand which outputs the full command output to stderr when HOMEBREW_DEBUG/--debug is set.

This is a great idea!

Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

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

Sending debug output to stderr makes sense to me, including doing so unconditionally. Fine with making it opt-out if someone needs it, but it's not something I'd personally use.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Ok, cool, fine with me, thanks @reitermarkus! A legit test failure needs fixed and then good to 🚢.

@reitermarkus
Copy link
Member Author

Yeah, the test is a bit flaky, I assume due to stdout being buffered while stderr isn't. Will take another look later.

@MikeMcQuaid MikeMcQuaid merged commit f89c719 into Homebrew:master Oct 11, 2023
27 checks passed
@reitermarkus reitermarkus deleted the odebug-system-command branch October 11, 2023 18:10
@github-actions github-actions bot added the outdated PR was locked due to age label Nov 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants