mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
avoid assertion error
This commit is contained in:
@@ -572,7 +572,18 @@ pub fn notifyNeedTermination(this: *WebWorker) callconv(.c) void {
|
||||
|
||||
if (this.vm) |vm| {
|
||||
vm.eventLoop().wakeup();
|
||||
vm.jsc.notifyNeedTermination();
|
||||
|
||||
// for process.exit() called from JavaScript, we only need to set the flag
|
||||
// and wake up the event loop. The event loop will check hasRequestedTerminate()
|
||||
// and exit cleanly. Calling notifyNeedTermination() while holding the js lock
|
||||
// causes assertion failures in jsc
|
||||
if (!this.exit_called) {
|
||||
// only call jsc traps for external terminate requests
|
||||
// (e.g worker.terminate() from parent thread)
|
||||
vm.jsc.notifyNeedTermination();
|
||||
}
|
||||
// if exit_called is true we're in process.exit() context and should
|
||||
// let the event loop handle termination naturally
|
||||
}
|
||||
|
||||
// TODO(@190n) delete
|
||||
|
||||
Reference in New Issue
Block a user