mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
* Fixes #9952 * Update CMakeLists.txt * Update CMakeLists.txt * linux * isolate this test
This commit is contained in:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
cmake_policy(SET CMP0067 NEW)
|
||||
|
||||
set(Bun_VERSION "1.1.2")
|
||||
set(Bun_VERSION "1.1.3")
|
||||
set(WEBKIT_TAG e3a2d89a0b1644cc8d5c245bd2ffee4d4bd6c1d5)
|
||||
|
||||
set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
@@ -186,6 +186,10 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#if OS(WINDOWS)
|
||||
extern "C" void Bun__setCTRLHandler(BOOL add);
|
||||
#endif
|
||||
|
||||
const ClassInfo TTYWrapObject::s_info = {
|
||||
"LibuvStreamWrap"_s,
|
||||
|
||||
@@ -251,6 +255,10 @@ JSC_DEFINE_HOST_FUNCTION(TTYWrap_functionSetMode,
|
||||
}
|
||||
|
||||
#if OS(WINDOWS)
|
||||
if (mode.toInt32(globalObject) == 0) {
|
||||
Bun__setCTRLHandler(1);
|
||||
}
|
||||
|
||||
int err = uv_tty_set_mode(ttyWrap->handle->tty(), mode.toInt32(globalObject));
|
||||
#else
|
||||
// Nodejs does not throw when ttySetMode fails. An Error event is emitted instead.
|
||||
|
||||
@@ -404,6 +404,25 @@ extern "C" void onExitSignal(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OS(WINDOWS)
|
||||
extern "C" void Bun__restoreWindowsStdio();
|
||||
BOOL WINAPI Ctrlhandler(DWORD signal)
|
||||
{
|
||||
|
||||
if (signal == CTRL_C_EVENT) {
|
||||
Bun__restoreWindowsStdio();
|
||||
SetConsoleCtrlHandler(Ctrlhandler, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern "C" void Bun__setCTRLHandler(BOOL add)
|
||||
{
|
||||
SetConsoleCtrlHandler(Ctrlhandler, add);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" void bun_initialize_process()
|
||||
{
|
||||
// Disable printf() buffering. We buffer it ourselves.
|
||||
@@ -517,6 +536,9 @@ extern "C" void bun_initialize_process()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add ctrl+c handler on windows
|
||||
Bun__setCTRLHandler(1);
|
||||
#endif
|
||||
|
||||
atexit(Bun__onExit);
|
||||
|
||||
@@ -148,6 +148,15 @@ pub const Source = struct {
|
||||
pub var console_codepage = @as(u32, 0);
|
||||
pub var console_output_codepage = @as(u32, 0);
|
||||
|
||||
pub export fn Bun__restoreWindowsStdio() callconv(.C) void {
|
||||
restore();
|
||||
}
|
||||
comptime {
|
||||
if (Environment.isWindows) {
|
||||
_ = &Bun__restoreWindowsStdio;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn restore() void {
|
||||
const peb = std.os.windows.peb();
|
||||
const stdout = peb.ProcessParameters.hStdOutput;
|
||||
|
||||
@@ -28,6 +28,7 @@ beforeAll(async () => {
|
||||
await new Promise<void>(done => {
|
||||
verdaccioServer.on("message", (msg: { verdaccio_started: boolean }) => {
|
||||
if (msg.verdaccio_started) {
|
||||
console.log("Verdaccio started");
|
||||
done();
|
||||
}
|
||||
});
|
||||
@@ -40,6 +41,7 @@ afterAll(() => {
|
||||
|
||||
beforeEach(async () => {
|
||||
packageDir = mkdtempSync(join(realpathSync(tmpdir()), "bun-install-registry-" + testCounter++ + "-"));
|
||||
env.BUN_INSTALL_CACHE_DIR = join(packageDir, ".bun-cache");
|
||||
await writeFile(
|
||||
join(packageDir, "bunfig.toml"),
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user