From 00f770d985e6ad1294746d4f1c1d72d3d7170d23 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/mycelium.rs') diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs index 9147a5d..a8a0e10 100644 --- a/src/transport/mycelium.rs +++ b/src/transport/mycelium.rs @@ -291,6 +291,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