chiark / gitweb /
cleanup notify - not working
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 23 Dec 2020 01:35:48 +0000 (01:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 23 Dec 2020 01:35:48 +0000 (01:35 +0000)
I think I am bollixing up Command's own pipe with my pipe in the
pre-exec hook

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver.rs

index 6baf13e63feb64b2c65f0c9437fac87c39af78ea..5a792aa208145c79def6bd1b982887d7268a8492 100644 (file)
@@ -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 => {