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

utils: Add a little CommandRunExt helper trait #733

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

cgwalters
Copy link
Collaborator

When I added the Task stuff it wasn't with the idea that we'd use it for all subprocess invocations.

I think in some cases we really just do want a Command instance without the extra wrappering.

Add an implementation (there are many of variants of this out there in lots of Rust codebases)

This makes sense to use instead of Task where we're using .quiet() so that we don't print the description, and especially where we don't expect the task to fail usually, so it's OK if the error message is odd.

When I added the `Task` stuff it wasn't with the idea
that we'd use it for *all* subprocess invocations.

I think in some cases we really just do want a `Command` instance
without the extra wrappering.

Add an implementation (there are many of variants of this out
there in lots of Rust codebases)

This makes sense to use instead of `Task` where we're using
`.quiet()` so that we don't print the description, and especially
where we don't expect the task to fail usually, so it's OK
if the error message is odd.

Signed-off-by: Colin Walters <walters@verbum.org>
@github-actions github-actions bot added the area/install Issues related to `bootc install` label Jul 25, 2024
fn run(&mut self) -> Result<()>;
}

impl CommandRunExt for Command {
Copy link
Member

Choose a reason for hiding this comment

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

I see you are using Command::new and not CommandRunExt above. I am not sure I follow how this gets wired. I imagine that now everytime someone uses Command::new it will use this instead, but have no idea how that is happening.

Copy link
Member

Choose a reason for hiding this comment

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

mmm I guess it's using trait and then the impl that wires this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, the trait adds a new method.

Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@cgwalters cgwalters merged commit 8d87d2a into containers:main Jul 26, 2024
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/install Issues related to `bootc install`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants