mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
test_infra, tests: Introduce exec_host_command_output() function
This new function allows for better readability of the code by factorizing a few of lines of code into a single one. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -11,7 +11,7 @@ use std::net::TcpListener;
|
||||
use std::net::TcpStream;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::Path;
|
||||
use std::process::ExitStatus;
|
||||
use std::process::{ExitStatus, Output};
|
||||
use std::str::FromStr;
|
||||
use std::thread;
|
||||
use vmm_sys_util::tempdir::TempDir;
|
||||
@@ -597,3 +597,10 @@ pub fn exec_host_command_status(command: &str) -> ExitStatus {
|
||||
.status()
|
||||
.expect(&format!("Expected '{}' to run", command))
|
||||
}
|
||||
|
||||
pub fn exec_host_command_output(command: &str) -> Output {
|
||||
std::process::Command::new("bash")
|
||||
.args(&["-c", command])
|
||||
.output()
|
||||
.expect(&format!("Expected '{}' to run", command))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user