diff options
| author | 2023-03-28 21:28:35 -0700 | |
|---|---|---|
| committer | 2023-03-28 21:28:35 -0700 | |
| commit | 786475ff58e0726100f6d48c7b12b9e559e22b82 (patch) | |
| tree | 832bdf56f63dd30402e78eaade35534efaa4ea8d /src/panic_handler.zig | |
| parent | b76384351c55917692a9dc3b7f08f771a55b3fa1 (diff) | |
| download | bun-786475ff58e0726100f6d48c7b12b9e559e22b82.tar.gz bun-786475ff58e0726100f6d48c7b12b9e559e22b82.tar.zst bun-786475ff58e0726100f6d48c7b12b9e559e22b82.zip | |
`bun --watch` and `bun test --watch` (#2500)
* --watch wip
* Upgrade for latest zig
* Implement `bun --watch`
* Implement `bun test --watch`
* Auto restart on crash in --watch
* :clock1: :clock2: :clock3: :clock330:
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/panic_handler.zig')
| -rw-r--r-- | src/panic_handler.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/panic_handler.zig b/src/panic_handler.zig index ff17ed7d1..4e2ca05f9 100644 --- a/src/panic_handler.zig +++ b/src/panic_handler.zig @@ -36,6 +36,15 @@ pub fn NewPanicHandler(comptime panic_func: fn ([]const u8, ?*std.builtin.StackT Output.disableBuffering(); + if (bun.auto_reload_on_crash) { + // attempt to prevent a double panic + bun.auto_reload_on_crash = false; + + Output.prettyErrorln("<d>--- Bun is auto-restarting due to crash <d>[time: <b>{d}<r><d>] ---<r>", .{@max(std.time.milliTimestamp(), 0)}); + Output.flush(); + bun.reloadProcess(bun.default_allocator, false); + } + // // We want to always inline the panic handler so it doesn't show up in the stacktrace. @call(.always_inline, panic_func, .{ msg, error_return_type, addr }); } |
