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:
Claude 2026-05-10 12:35:21 +00:00
parent 2294f52407
commit 1464d46172
No known key found for this signature in database

View file

@ -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(