diff --git a/std/os.zig b/std/os.zig index a4e8ca3ad8..9ca78fa9f3 100644 --- a/std/os.zig +++ b/std/os.zig @@ -138,15 +138,18 @@ fn getRandomBytesDevURandom(buf: []u8) !void { /// it raises SIGABRT followed by SIGKILL and finally lo pub fn abort() noreturn { @setCold(true); - if (builtin.link_libc) { - system.abort(); - } + // MSVCRT abort() sometimes opens a popup window which is undesirable, so + // even when linking libc on Windows we use our own abort implementation. + // See https://github.com/ziglang/zig/issues/2071 for more details. if (windows.is_the_target) { if (builtin.mode == .Debug) { @breakpoint(); } windows.kernel32.ExitProcess(3); } + if (builtin.link_libc) { + system.abort(); + } if (builtin.os == .uefi) { // TODO there must be a better thing to do here than loop forever while (true) {}