From efb0c68e0be6413636a3509e550d187447de408d Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 21 Oct 2026 14:34:06 +0200 Subject: install signal handlers early & handle SIGTERM --- src/transport/mycelium.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/transport') diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs index c2d0181..7d88d73 100644 --- a/src/transport/mycelium.rs +++ b/src/transport/mycelium.rs @@ -279,6 +279,12 @@ impl SupervisedMycelium { for &fd in &fds_to_inherit { libc::fcntl(fd, libc::F_SETFD, 0); } + // Own process group: a Ctrl-C in the terminal goes to continuum only, + // which then stops Mycelium itself, instead of both exiting at once (which + // shows up as "Mycelium runtime process exited"). + if libc::setpgid(0, 0) != 0 { + return Err(std::io::Error::last_os_error()); + } #[cfg(target_os = "linux")] { if libc::prctl(libc::PR_SET_PDEATHSIG, libc::SIGTERM) != 0 { -- cgit v1.3.1