use artifactize_foundation::platform::process::*;
use std::io;
#[test]
fn exit_probe() {
if let Some(code) = std::env::var_os("ARTIFACTIZE_EXIT_PROBE") {
std::process::exit(code.to_str().unwrap().parse().unwrap());
}
}
#[tokio::test]
async fn exit_code_259_does_not_mean_the_process_is_alive() {
let mut child = crate::test_os::windows_exit(259).spawn().unwrap();
let pid = child.id().unwrap();
assert_eq!(child.wait().await.unwrap().code(), Some(259));
assert!(
!crate::test_os::running(pid),
"the fixture sees a terminated process"
);
assert_eq!(
process_start_time(pid).unwrap_err().kind(),
io::ErrorKind::NotFound
);
}