diff --git a/src/term/pty.rs b/src/term/pty.rs index 38c9474..5f03e56 100644 --- a/src/term/pty.rs +++ b/src/term/pty.rs @@ -337,7 +337,8 @@ mod tests { #[test] fn a_program_that_ignores_sighup_ends_when_the_pty_closes() { - close_after_ready("trap '' HUP; printf READY; exec cat", "exit status: 0"); + // cat reads EOF on macOS and EIO on Linux; the shell's own exit holds on both. + close_after_ready("trap '' HUP; printf READY; cat; exit 7", "exit status: 7"); } #[test] diff --git a/src/term/unix.rs b/src/term/unix.rs index fa0bf03..6c688db 100644 --- a/src/term/unix.rs +++ b/src/term/unix.rs @@ -289,7 +289,7 @@ impl Drop for Pty { fn drop(&mut self) { unsafe { libc::kill(self.child.id() as libc::pid_t, libc::SIGHUP) }; unregister(self.sig); - // Closed before the wait, so a program that ignores SIGHUP reads EOF. + // Closed before the wait, so a program that ignores SIGHUP finds the terminal gone. unsafe { ManuallyDrop::drop(&mut self.file) }; match self.child.wait() { Ok(status) => log::info!("pty {}: hung up, {status}", self.id()),