windows: the app's Logs page; on Linux, units end with the service

- Logs: every unit's as they come (the last 500 first, 5000 kept), one
  unit's on its own, following or held; terminal colours stripped; a
  virtual list, so thousands of lines cost nothing. The follow starts
  when the page is first opened and reconnects by itself.
- Linux (development, tests): the service's children get SIGKILL when it
  dies (PR_SET_PDEATHSIG), as the Job Object does on Windows; a killed
  service no longer leaves sing-box running (the e2e test leaked one per
  run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 01:41:12 +03:00
1 parent a839d48e02
commit 23c1687118
5 files changed
+176 -1

No files matched your search

+12
View File
@@ -280,6 +280,18 @@ async fn run(ctx: RunCtx, mut stop: watch::Receiver<bool>) {
// No console window for the children.
cmd.creation_flags(0x0800_0000);
}
// On Linux (development, tests) the children end with the service, as the Job Object
// ends them on Windows, even when the service is killed outright. The signal comes when
// the spawning thread ends: a runtime worker, which lives as long as the service.
#[cfg(target_os = "linux")]
unsafe {
cmd.pre_exec(|| {
if libc::prctl(libc::PR_SET_PDEATHSIG, libc::SIGKILL) != 0 {
return Err(std::io::Error::last_os_error());
}
Ok(())
});
}
let mut child = match cmd.spawn() {
Ok(c) => c,
Err(e) => {