Browse Source

More meaningful error message when a subprocess is killed (#414)

remotes/origin/add-with-shims
Gal Schlezinger 4 years ago committed by GitHub
parent
commit
2cfaa39b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/commands/exec.rs

7
src/commands/exec.rs

@ -71,7 +71,8 @@ impl Cmd for Exec {
.wait() .wait()
.expect("Failed to grab exit code"); .expect("Failed to grab exit code");
std::process::exit(exit_status.code().unwrap()); let code = exit_status.code().context(CantReadProcessExitCode)?;
std::process::exit(code);
} }
} }
@ -94,6 +95,10 @@ pub enum Error {
ApplicableVersionError { ApplicableVersionError {
source: UserInputError, source: UserInputError,
}, },
#[snafu(display(
"Can't read exit code from process.\nMaybe the process was killed using a signal?"
))]
CantReadProcessExitCode,
#[snafu(display("command not provided. Please provide a command to run as an argument, like {} or {}.\n{} {}", "node".italic(), "bash".italic(), "example:".yellow().bold(), "fnm exec --using=12 node --version".italic().yellow()))] #[snafu(display("command not provided. Please provide a command to run as an argument, like {} or {}.\n{} {}", "node".italic(), "bash".italic(), "example:".yellow().bold(), "fnm exec --using=12 node --version".italic().yellow()))]
NoBinaryProvided, NoBinaryProvided,
} }

Loading…
Cancel
Save