mirror of
https://github.com/containers/youki
synced 2024-05-09 17:16:16 +02:00
464344923f
* Name the test tools `contest` Signed-off-by: utam0k <k0ma@utam0k.jp> * Address the feedbacks Signed-off-by: utam0k <k0ma@utam0k.jp> * Fix a build error Signed-off-by: utam0k <k0ma@utam0k.jp> * Fix a workflow Signed-off-by: utam0k <k0ma@utam0k.jp> * Address the feedbacks Signed-off-by: utam0k <k0ma@utam0k.jp> --------- Signed-off-by: utam0k <k0ma@utam0k.jp>
22 lines
674 B
Rust
22 lines
674 B
Rust
use anyhow::{bail, Result};
|
|
use std::{io, process};
|
|
|
|
pub fn get_result_from_output(res: io::Result<process::Output>) -> Result<()> {
|
|
match res {
|
|
io::Result::Ok(output) => {
|
|
let stderr = String::from_utf8(output.stderr).unwrap();
|
|
if stderr.contains("Error") || stderr.contains("error") {
|
|
let stdout = String::from_utf8(output.stdout).unwrap();
|
|
bail!("Error :\nstdout : {}\nstderr : {}", stdout, stderr)
|
|
} else {
|
|
Ok(())
|
|
}
|
|
}
|
|
io::Result::Err(e) => Err(anyhow::Error::new(e)),
|
|
}
|
|
}
|
|
|
|
pub fn criu_installed() -> bool {
|
|
which::which("criu").is_ok()
|
|
}
|