fix: also show script stderr

This commit is contained in:
əlemi 2024-02-13 21:47:08 +01:00
parent f6d570fccd
commit d2801410c3
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -57,13 +57,17 @@ fn main() {
fn shell<S : AsRef<std::ffi::OsStr>>(cmd: S) -> std::io::Result<String> {
let output = std::process::Command::new(cmd).output()?;
match std::str::from_utf8(&output.stdout) {
Ok(s) => Ok(s.to_string()),
Err(e) => {
println!("[?] shell produced non-utf8 output ({e})");
Ok(format!("{:?}", output.stdout))
},
}
let stderr = match std::str::from_utf8(&output.stderr) {
Ok(s) => s.to_string(),
Err(_) => format!("{:?}", output.stderr),
};
let stdout = match std::str::from_utf8(&output.stdout) {
Ok(s) => s.to_string(),
Err(_) => format!("{:?}", output.stdout),
};
Ok(format!("{stderr}{stdout}"))
}
fn tci(cfg: TciConfig) -> Result<(), Box<dyn std::error::Error>> {