no autofail
This commit is contained in:
parent
5f56b7fb77
commit
4efd828912
1 changed files with 9 additions and 2 deletions
11
src/linux.rs
11
src/linux.rs
|
@ -1,7 +1,7 @@
|
||||||
use nix::{unistd::Uid, unistd::getuid};
|
use nix::{unistd::Uid, unistd::getuid};
|
||||||
use std::{io::Write, os::unix::fs::PermissionsExt};
|
use std::{io::Write, os::unix::fs::PermissionsExt};
|
||||||
|
|
||||||
use crate::print_status;
|
use crate::{expect_yes, print_status};
|
||||||
|
|
||||||
pub fn is_root() -> bool {
|
pub fn is_root() -> bool {
|
||||||
getuid() == Uid::from_raw(0)
|
getuid() == Uid::from_raw(0)
|
||||||
|
@ -78,7 +78,6 @@ pub fn run_command(cmd: &[&str], input: Option<&str>, inherit: bool) -> (String,
|
||||||
}
|
}
|
||||||
|
|
||||||
let status = child.wait_with_output().unwrap();
|
let status = child.wait_with_output().unwrap();
|
||||||
assert!(status.status.success());
|
|
||||||
|
|
||||||
let output = String::from_utf8(status.stdout).unwrap();
|
let output = String::from_utf8(status.stdout).unwrap();
|
||||||
let stderr = String::from_utf8(status.stderr).unwrap();
|
let stderr = String::from_utf8(status.stderr).unwrap();
|
||||||
|
@ -91,6 +90,14 @@ pub fn run_command(cmd: &[&str], input: Option<&str>, inherit: bool) -> (String,
|
||||||
println!("{output}");
|
println!("{output}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !status.status.success() {
|
||||||
|
println!(
|
||||||
|
"Command '{}' failed. Do you want to continue still? Type 'yes'",
|
||||||
|
cmd.join(" ")
|
||||||
|
);
|
||||||
|
expect_yes();
|
||||||
|
}
|
||||||
|
|
||||||
(output, stderr)
|
(output, stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue