From: Ian Jackson Date: Wed, 23 Dec 2020 01:35:48 +0000 (+0000) Subject: cleanup notify - not working X-Git-Tag: otter-0.2.0~156 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9ce20b5ddb4ea3a7a53fee610d7694823f0eaf1e;p=otter.git cleanup notify - not working I think I am bollixing up Command's own pipe with my pipe in the pre-exec hook Signed-off-by: Ian Jackson --- diff --git a/wdriver.rs b/wdriver.rs index 6baf13e6..5a792aa2 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -48,9 +48,9 @@ mod cleanup_notify { pub struct Handle(RawFd); - #[throws(AE)] + #[throws(io::Error)] fn mkpipe() -> (RawFd,RawFd) { - pipe2(OFlag::O_CLOEXEC)? + pipe2(OFlag::O_CLOEXEC).map_err(nix2io)? } #[throws(io::Error)] @@ -83,14 +83,12 @@ mod cleanup_notify { pub fn arm_hook(&self, cmd: &mut Command) { unsafe { use std::os::unix::process::CommandExt; - let (reading_end, writing_end) = mkpipe() - .context("create permission to carry on pipe")?; - let notify_writing_end = self.0; let all_signals = nix::sys::signal::SigSet::all(); cmd.pre_exec(move || -> Result<(), io::Error> { let semidaemon = nix::unistd::getpid(); + let (reading_end, writing_end) = mkpipe()?; match fork().map_err(nix2io)? { ForkResult::Child => {