From f85728a72eb756c9e260c6afbdfab961ed414566 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 d31925d..0c816c5 100644 --- a/src/transport/mycelium.rs +++ b/src/transport/mycelium.rs @@ -280,6 +280,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