diff options
| author | tv <tv@krebsco.de> | 2026-10-21 14:34:06 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-21 14:34:06 +0200 |
| commit | efb0c68e0be6413636a3509e550d187447de408d (patch) | |
| tree | 53a4d4cb8dc349395f4a984481bbb8a9bcd75bb4 /src/transport | |
| parent | 8022ef5eebf514f2baef3820e2ed517f0d198caf (diff) | |
install signal handlers early & handle SIGTERM
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/mycelium.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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 { |
