use std::io;
use std::process::{Child, Command, ExitStatus, Output};
pub fn spawn(command: &mut Command) -> io::Result<Child> {
command.spawn()
}
pub fn status(command: &mut Command) -> io::Result<ExitStatus> {
command.status()
}
pub fn output(command: &mut Command) -> io::Result<Output> {
command.output()
}
#[allow(unused_imports)]
pub use crate::foreground_imp::*;
#[cfg(test)]
pub(crate) mod tests {
use super::*;
pub(crate) fn fixture_command(program: impl AsRef<std::ffi::OsStr>) -> Command {
Command::new(program)
}
#[test]
fn spawn_preserves_native_missing_program_error() {
let directory = tempfile::tempdir().expect("private fixture directory");
let mut command = Command::new(directory.path().join("absent-executable"));
let error = spawn(&mut command).expect_err("no child should be created");
assert_eq!(error.kind(), io::ErrorKind::NotFound);
}
}