From 45b505c93070cb0815e81c9e909e9ce840569af3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 27 May 2024 10:49:26 -0700 Subject: [PATCH] std.process.cleanExit: lock stderr before exiting This makes it so that any other threads which are writing to stderr have a chance to finish before the process terminates. It also clears the terminal in case any progress has been written to stderr, while still accomplishing the goal of not waiting until the update thread exits. --- lib/std/process.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/process.zig b/lib/std/process.zig index 5fb36f991d..e55ce7ff41 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -1760,6 +1760,7 @@ pub fn cleanExit() void { if (builtin.mode == .Debug) { return; } else { + std.debug.lockStdErr(); exit(0); } }