-
Notifications
You must be signed in to change notification settings - Fork 9
feat: change child wrapper inner()s to return one layer down #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'll give this a try in just a moment! I am currently forced to be on Windows, so hopefully I won't run into that stack overflow, but I'll let you know if I do! Additionally, and maybe this is best of a separate PR, I've run into the case where I think I'll need fn pre_spawn(&mut self, command: &mut Command, _core: &StdCommandWrap) -> io::Result<()> {
let mut logfile = File::create(&self.path)?;
let (mut rx, tx) = pipe()?;
self.thread = Some(thread::spawn(move || {
io::copy(&mut rx, &mut logfile).unwrap();
}));
command.stdout(tx.try_clone()?).stderr(tx);
Ok(())
} But that thread will never return / be joined if anything is holding onto a copy of command
.stdout(Stdio::null())
.stderr(Stdio::null()); Or similar, or else my program completely deadlocks when I try to join the thread in fn wait(&mut self) -> io::Result<ExitStatus> {
let exit_status = self.inner.wait();
if let Some(thread) = mem::take(&mut self.thread) {
thread.join().expect("logfile thread panicked");
}
exit_status
} Let me know if it's possible to change the signature of |
Furthermore, if we can get things to a functional state you're happy with, I'm more than happy to expand on the "Custom Wrappers" part of the documentation and can include my |
that would be very welcome! |
That's done now in #24 ! |
Implementation for #22
Migration for tokio: replace
Box::into_pin(child.wait())
withchild.wait()