From fc963064c6400d86d22973bb0741d9ed2ad57553 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 30 Dec 2023 15:43:50 -0800 Subject: [PATCH] termio/exec: abnormal exit can use exit code on linux --- src/termio/Exec.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 0323919fc..ff4ed2ac8 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -741,6 +741,14 @@ fn processExit( // If our runtime was below some threshold then we assume that this // was an abnormal exit and we show an error message. if (runtime_ms) |runtime| runtime: { + // On macOS, our exit code detection doesn't work, possibly + // because of our `login` wrapper. More investigation required. + if (comptime !builtin.target.isDarwin()) { + // If our exit code is zero, then the command was successful + // and we don't ever consider it abnormal. + if (code == 0) break :runtime; + } + if (runtime > abnormal_runtime_threshold_ms) break :runtime; log.warn("abnormal process exit detected, showing error message", .{});