termio/exec: abnormal exit can use exit code on linux

This commit is contained in:
Mitchell Hashimoto
2023-12-30 15:43:50 -08:00
parent 3ee842e1b7
commit fc963064c6

View File

@ -741,6 +741,14 @@ fn processExit(
// If our runtime was below some threshold then we assume that this // If our runtime was below some threshold then we assume that this
// was an abnormal exit and we show an error message. // was an abnormal exit and we show an error message.
if (runtime_ms) |runtime| runtime: { 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; if (runtime > abnormal_runtime_threshold_ms) break :runtime;
log.warn("abnormal process exit detected, showing error message", .{}); log.warn("abnormal process exit detected, showing error message", .{});