//TODO: Do we need to fcntl() this to make it (the fd) RW?
matchfile{
@ -60,17 +65,18 @@ where I: IntoIterator<Item = OsString>,
}
};
letmutchild=process::Command::new(filename)
letchild=process::Command::new(filename)
.args(args)
.stdin(file.as_ref().map(|file|process::Stdio::piped()/*::from(file)*/).unwrap_or_else(||process::Stdio::null()))//XXX: Maybe change to `piped()` and `io::copy()` from begining (using pread()/send_file()/copy_file_range()?)
.stdin(file.as_ref().map(|file|process::Stdio::from(fs::File::from(dup_file(file).unwrap()))).unwrap_or_else(||process::Stdio::null()))//XXX: Maybe change to `piped()` and `io::copy()` from begining (using pread()/send_file()/copy_file_range()?)
.stdout(process::Stdio::inherit())
.stderr(process::Stdio::inherit())
.spawn()?;
//TODO: XXX: Why does `/proc/{pid}/fd/{fd}` **and** `/dev/fd/{fd}` not work for -exec{}, and why foes `Stdio::from(file)` not work for stdin even *afer* re-seeking the file???
//todo!("Map `spawn_from(...)` and wait for each child to terminate concurrently. Then return an iterator or the return codes or spawning errors for that now terminated child.")