feat(hot-clear-screen): clear terminal on hot reload (#3976)

* feat(hot-clear-screen): clear terminal on hot reload

* fix(hot-clear-screen): is now I n the correct place

* fix(hot-clear-screen): enable buffering after terminal clear
This commit is contained in:
simylein
2023-08-04 13:01:10 +02:00
committed by GitHub
parent 76dee9312b
commit 18a2e18ae1

View File

@@ -626,6 +626,13 @@ pub const VirtualMachine = struct {
bun.reloadProcess(bun.default_allocator, !strings.eqlComptime(this.bundler.env.map.get("BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD") orelse "0", "true"));
}
if (!strings.eqlComptime(this.bundler.env.map.get("BUN_CONFIG_NO_CLEAR_TERMINAL_ON_RELOAD") orelse "0", "true")) {
Output.flush();
Output.disableBuffering();
Output.resetTerminalAll();
Output.enableBuffering();
}
this.global.reload();
this.pending_internal_promise = this.reloadEntryPoint(this.main) catch @panic("Failed to reload");
}