mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-05-12 05:10:32 +00:00
fix: kill and wait stremio-runtime child after readers finish
After both stdout and stderr readers exited, the Child handle was just dropped at the end of the match arm. On Windows std::process::Child's Drop neither kills nor waits, so the OS process kept its kernel object (and its bound ports) alive until either the JobObject KILL_ON_JOB_CLOSE fired on shell exit or init adopted it. In the crash-restart path this is worse: a fresh start() is launched while the previous runtime is still being reaped, and both processes race for port 11470. Explicitly kill().ok() + wait().ok() once the readers see EOF so the previous runtime is gone before we report 'Server terminated.' and fire the crash notice. Errors from killing an already-exited child are intentionally swallowed. Closes #50
This commit is contained in:
parent
2294f52407
commit
1464d46172
1 changed files with 3 additions and 0 deletions
|
|
@ -178,6 +178,9 @@ impl StremioServer {
|
|||
});
|
||||
out_thread.join().ok();
|
||||
err_thread.join().ok();
|
||||
// Drop on Windows neither kills nor waits, so reap explicitly.
|
||||
child.kill().ok();
|
||||
child.wait().ok();
|
||||
}
|
||||
Err(err) => {
|
||||
nwg::error_message(
|
||||
|
|
|
|||
Loading…
Reference in a new issue