use std::io::Write;
use std::path::Path;
use std::process::{Child, ChildStdin, Command, Stdio};
pub fn executable(path: &Path, content: &[u8]) {
use std::os::unix::fs::PermissionsExt;
let mut writer: Child = Command::new("tee")
.arg(path)
.stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn()
.expect("start fixture writer");
let mut input: ChildStdin = writer.stdin.take().expect("fixture writer input");
input.write_all(content).expect("write candidate");
drop(input);
assert!(
writer.wait().expect("fixture writer exit").success(),
"fixture writer failed for {path:?}"
);
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755))
.expect("mark candidate executable");
}