On Client.stop, terminate the isolate

Shutdown on MacOS doesn't work properly. The process appears to shutdown, but
will continue to run in the background. It can run infinitely if it's stuck in
a JS loop. To help it along, Client.stop now force-terminates the isolate.

I also don't think shutdown is working as intended on Linux, but the problem
seems less serious there. On Linux, it appears to properly kill the process
(which is the important thing), but I don't think it necessarily does a clean
shutdown.
This commit is contained in:
Karl Seguin
2026-02-27 08:20:31 +08:00
parent 99c09ba8a1
commit d56e63a91b
2 changed files with 8 additions and 0 deletions

View File

@@ -296,6 +296,10 @@ pub const Client = struct {
}
fn stop(self: *Client) void {
switch (self.mode) {
.http => {},
.cdp => |*cdp| cdp.browser.env.terminate(),
}
self.ws.shutdown();
}