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_status() function
This new function allows for better readability of the code by factorizing a bunch of lines of code into a single one. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -11,6 +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::str::FromStr;
|
||||
use std::thread;
|
||||
use vmm_sys_util::tempdir::TempDir;
|
||||
@@ -589,3 +590,10 @@ pub fn ssh_command_ip(
|
||||
timeout,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn exec_host_command_status(command: &str) -> ExitStatus {
|
||||
std::process::Command::new("bash")
|
||||
.args(&["-c", command])
|
||||
.status()
|
||||
.expect(&format!("Expected '{}' to run", command))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user