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

Use system_command instead of Utils.popen_read. #595

Closed
wants to merge 3 commits into from

Conversation

reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Oct 7, 2023

Previously, output would be broken when using HOMEBREW_DEBUG=1 and --json, since odebug outputs to stdout (maybe it should always output to stderr?).

SystemCommand already automatically handles HOMEBREW_DEBUG, so let's use that instead of manually calling odebug for every command here.

Bug seen here: https://github.com/reitermarkus/dotfiles/actions/runs/6435999795/job/17478462126#step:3:14451

@reitermarkus reitermarkus force-pushed the system-command branch 3 times, most recently from ab2ce27 to 1e2aa89 Compare October 7, 2023 02:50
Comment on lines 212 to 214
result = system_command(System.launchctl.to_s, args: ["list", service_name])
output = result.stdout.chomp

if result.success? && output.present?
success = true
odebug cmd.join(" "), output
Copy link
Member

Choose a reason for hiding this comment

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

Does this still output the actual output of these commands or just the command being run?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only the command being run.

Copy link
Member

Choose a reason for hiding this comment

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

The output is the important part though

Copy link
Member Author

@reitermarkus reitermarkus Oct 9, 2023

Choose a reason for hiding this comment

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

Do we need this debug output particularly often that it warrants outputting more than just the command? I think this is the only instance where we use odebug this way.

Copy link
Member

Choose a reason for hiding this comment

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

The command is actually the least relevant part of this function. The output will help developers figure out why something doesn't show up in the output.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need this debug output particularly often that it warrants outputting more than just the command?

Yes. I've done a lot of development on brew services recently and this has been extremely useful.

If you're not doing brew services development: I have no idea why you're running this with HOMEBREW_DEBUG or --debug?

Copy link
Member Author

@reitermarkus reitermarkus Oct 9, 2023

Choose a reason for hiding this comment

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

It's not that I'm running brew services specifically in debug mode, I'm running everything in debug mode in CI and this just happens to have broken output now.

Copy link
Member

Choose a reason for hiding this comment

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

Yeh, don't do that for your dot files 😁

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.

Needs to output the command output.

Copy link

github-actions bot commented Nov 1, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Nov 1, 2023
@github-actions github-actions bot closed this Nov 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants