#[cfg(not(any(feature = "force-inprocess", target_os = "android", target_os = "ios")))]
use ipc_channel::ipc::IpcOneShotServer;
#[cfg(not(any(feature = "force-inprocess", target_os = "android", target_os = "ios")))]
use std::{env, process};
#[cfg(not(any(feature = "force-inprocess", target_os = "android", target_os = "ios")))]
#[test]
fn spawn_one_shot_server_client() {
let executable_path: String = env!("CARGO_BIN_EXE_spawn_client_test_helper").to_string();
let (server, token) =
IpcOneShotServer::<String>::new().expect("Failed to create IPC one-shot server.");
let mut command = process::Command::new(executable_path);
let child_process = command.arg(token);
let mut child = child_process
.spawn()
.expect("Failed to start child process");
let (_rx, msg) = server.accept().expect("accept failed");
assert_eq!("test message", msg);
let result = child.wait().expect("wait for child process failed");
assert!(
result.success(),
"child process failed with exit status code {}",
result.code().expect("exit status code not available")
);
}