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

fix: Executor::spawn()/output() should not use their _checked() variants #1002

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

SteveLauC
Copy link
Member

@SteveLauC SteveLauC commented Dec 10, 2024

What does this PR do

CommandExt::output_checked() returns Err() if the command fails, using it in Executor::output() will make its behavior different from std::process::Command::output().

The same applies to spawn() as well. Executor does not have a status() command.

These changes were made 2 years ago by @9999years, it would be great if we can have you here and take a look at this PR:)

Standards checklist

  • The PR title is descriptive
  • I have read CONTRIBUTING.md
  • Optional: I have tested the code myself
  • If this PR introduces new user-facing messages they are translated

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step
  • Optional: The --yes option works with this step if it is supported by
    the underlying command

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

clippy.toml Outdated
@@ -1,5 +0,0 @@
disallowed-methods = [
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to keep these for the rest of the codebase and do #[allow(clippy::disallowed_methods)] on the calls in src/executor.rs (where we have a reason to use the raw spawn method).

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense:)

Copy link
Contributor

@9999years 9999years left a comment

Choose a reason for hiding this comment

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

This looks good! Thanks for the ping —I really love topgrade so I'm happy to review PRs like this. Thanks for all you do to maintain it!

@9999years
Copy link
Contributor

BTW, since I wrote the CommandExt trait used in topgrade, I've expanded and polished it into the command_error crate (which builds on the utf_command crate); we might consider switching to that at some point.

@SteveLauC SteveLauC changed the title fix: Executor::output() should not use output_checked() fix: Executor::spawn()/output() should not use their _checked() variants Dec 11, 2024
@SteveLauC
Copy link
Member Author

BTW, since I wrote the CommandExt trait used in topgrade, I've expanded and polished it into the command_error crate (which builds on the utf_command crate); we might consider switching to that at some point.

Neat! Topgrade should switch to it!

@SteveLauC SteveLauC merged commit dc9d8d5 into topgrade-rs:main Dec 11, 2024
12 checks passed
@SteveLauC SteveLauC deleted the fix/Executor_output branch December 11, 2024 01:13
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