//! Passes a privately duplicated handle through a child-side protocol.
#[cfg(windows)]fnmain()->std::io::Result<()>{usestd::fs::File;usewindows_spawn::Command;let log =File::create("worker.log")?;letmut command =Command::new("worker.exe");
command.arg("--log-handle").arg_handle(&log)?;// arg_handle stored a private non-inheritable duplicate. The worker
// protocol parses the following decimal argument as its borrowed handle.
drop(log);let status = command.status()?;assert!(status.success());Ok(())}#[cfg(not(windows))]fnmain(){}