mirror of
https://git.alemi.dev/tci.git
synced 2024-11-23 08:34:51 +01:00
fix: also show script stderr
This commit is contained in:
parent
f6d570fccd
commit
d2801410c3
1 changed files with 11 additions and 7 deletions
18
src/main.rs
18
src/main.rs
|
@ -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>> {
|
||||
|
|
Loading…
Reference in a new issue