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

Replace rustup with running command #972

Closed
wants to merge 3 commits into from
Closed

Replace rustup with running command #972

wants to merge 3 commits into from

Conversation

KalitaAlexey
Copy link

@KalitaAlexey KalitaAlexey commented Feb 28, 2017

I copied the implementation from Cargo.

I don't know if I can add any tests for that.

I checked on Ubuntu and Windows.

Fixes #806
Fixes #845

@KalitaAlexey
Copy link
Author

@birkenfeld,
Can you check if it fixes your problem?

@KalitaAlexey
Copy link
Author

@nrc,
Don't you know if @brson is on vocation?

@KalitaAlexey
Copy link
Author

@brson,
I don't know why it failed.

fn run(mut command: Command, arg0: &str) -> Result<()> {
use std::os::unix::process::CommandExt;
let error = command.exec();
Err(error).chain_err(|| rustup_utils::ErrorKind::RunningCommand {
Copy link
Member

Choose a reason for hiding this comment

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

You’ll probably want to chain the error after calling run, like this:

run(cmd, arg0).chain_err(|| ...)

instead. That greatly cuts down on the amount of code needed.

Copy link
Member

Choose a reason for hiding this comment

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

See for example similar code in cargo-fuzz

Copy link
Author

Choose a reason for hiding this comment

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

Sounds reasonable. Thanks.

@brson
Copy link
Contributor

brson commented Mar 17, 2017

Hi @KalitaAlexey.

Thanks for the fixes, and sorry for the delay.

This does solve the problem, but I want to solve these two issues a different way, and the main reason is that rustup wants to be able to perform work after the invoked subcommand is run (e.g. recording telemetry about the results). I am not prepared to give up that capability yet.

I'd instead prefer to do something more along the lines described in the op of #806, installing a signal handler and capturing Ctrl+C. Likewise the signal-swallowing can be handled by examining how the subprocess terminated.

@brson brson mentioned this pull request Mar 17, 2017
@bors
Copy link
Contributor

bors commented Mar 17, 2017

☔ The latest upstream changes (presumably #968) made this pull request unmergeable. Please resolve the merge conflicts.

@KalitaAlexey
Copy link
Author

@brson,
If you know how to do that, you should do it because I don't know.
I need to think about it.

@nagisa
Copy link
Member

nagisa commented Mar 17, 2017 via email

@birkenfeld
Copy link

I agree with @nagisa - especially in that rustup-rustc/rustup-cargo should behave the same as normal rustc/cargo. This is otherwise very confusing to users who shouldn't have to care about how their toolchain was installed.

@Diggsey
Copy link
Contributor

Diggsey commented May 17, 2017

I'll close this, since we're not planning on using exec - further discussion about whether this is the right decision can happen on the issue (#31)

@Diggsey Diggsey closed this May 17, 2017
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.

6 participants