From 114c3f56656354ebee0cf434a1aabf56681522f1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 1 Jul 2025 12:06:37 -0700 Subject: [PATCH 1/2] Fix abnormal exit detection on macOS I made an oopsie with #7705 and omitted the check entirely on macOS when the original logic only omitted the exit code check. --- src/Surface.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 390adf91b..cef71f265 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1002,10 +1002,11 @@ fn childExited(self: *Surface, info: apprt.surface.Message.ChildExited) void { if (info.runtime_ms <= self.config.abnormal_command_exit_runtime_ms) runtime: { // On macOS, our exit code detection doesn't work, possibly // because of our `login` wrapper. More investigation required. - if (comptime builtin.target.os.tag.isDarwin()) break :runtime; + if (comptime !builtin.target.os.tag.isDarwin()) { + // If the exit code is 0 then we it was a good exit. + if (info.exit_code == 0) break :runtime; + } - // If the exit code is 0 then we it was a good exit. - if (info.exit_code == 0) break :runtime; log.warn("abnormal process exit detected, showing error message", .{}); // Update our terminal to note the abnormal exit. In the future we From fbdaea745698d20c994853524b9be5076954e8ba Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 1 Jul 2025 12:15:45 -0700 Subject: [PATCH 2/2] Update src/Surface.zig Co-authored-by: Gregory Anders --- src/Surface.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surface.zig b/src/Surface.zig index cef71f265..dc7b0e3bf 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1003,7 +1003,7 @@ fn childExited(self: *Surface, info: apprt.surface.Message.ChildExited) void { // On macOS, our exit code detection doesn't work, possibly // because of our `login` wrapper. More investigation required. if (comptime !builtin.target.os.tag.isDarwin()) { - // If the exit code is 0 then we it was a good exit. + // If the exit code is 0 then it was a good exit. if (info.exit_code == 0) break :runtime; }