diff options
| author | Philipp Krones <hello@philkrones.com> | 2023-05-05 17:45:49 +0200 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2023-05-05 17:45:49 +0200 |
| commit | 7e9abb311df2ecc61ea294f98a6eda03612178ef (patch) | |
| tree | 0df45dc80cc4509473cb8a1d49ec16be50670f1c /clippy_dev/src/lib.rs | |
| parent | 8518391e72e46d0a7886f582145793332055ab90 (diff) | |
| download | rust-7e9abb311df2ecc61ea294f98a6eda03612178ef.tar.gz rust-7e9abb311df2ecc61ea294f98a6eda03612178ef.zip | |
Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup
Diffstat (limited to 'clippy_dev/src/lib.rs')
| -rw-r--r-- | clippy_dev/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index 3a8b070d735..56a269288c0 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -10,7 +10,9 @@ extern crate rustc_driver; extern crate rustc_lexer; +use std::io; use std::path::PathBuf; +use std::process::{self, ExitStatus}; pub mod bless; pub mod dogfood; @@ -58,3 +60,14 @@ pub fn clippy_project_root() -> PathBuf { } panic!("error: Can't determine root of project. Please run inside a Clippy working dir."); } + +pub fn exit_if_err(status: io::Result<ExitStatus>) { + match status.expect("failed to run command").code() { + Some(0) => {}, + Some(n) => process::exit(n), + None => { + eprintln!("Killed by signal"); + process::exit(1); + }, + } +} |
