Compare commits

...

3 Commits

Author SHA1 Message Date
Jarred Sumner
ca3a799105 Merge branch 'main' into jarred/exit-quicklier 2024-09-26 14:20:50 -07:00
Jarred Sumner
26f764e299 Update Global.zig 2024-09-26 00:14:47 -07:00
Jarred Sumner
c3decd4e1a Use _exit but restore stdio on error 2024-09-26 00:05:38 -07:00

View File

@@ -95,10 +95,11 @@ export fn Bun__atexit(function: ExitFn) void {
}
pub fn runExitCallbacks() void {
for (on_exit_callbacks.items) |callback| {
const callbacks = on_exit_callbacks.items;
on_exit_callbacks.items.len = 0;
for (callbacks) |callback| {
callback();
}
on_exit_callbacks.items.len = 0;
}
var is_exiting = std.atomic.Value(bool).init(false);
@@ -116,6 +117,11 @@ pub fn exit(code: u32) noreturn {
// If we are crashing, allow the crash handler to finish it's work.
bun.crash_handler.sleepForeverIfAnotherThreadIsCrashing();
if (code != 0) {
Bun__onExit();
std.c._exit(@bitCast(code));
}
switch (Environment.os) {
.mac => std.c.exit(@bitCast(code)),
else => bun.C.quick_exit(@bitCast(code)),