summaryrefslogtreecommitdiff
path: root/src/Command.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-16 20:54:17 -0800
committerMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-16 20:54:17 -0800
commitd567a976b46f71ed815f07ed68fd12a8b384aad9 (patch)
tree670e5aee4604fb479475b19564cede863cfecb8f /src/Command.zig
parent56b5c81fcb8f6350eaf7f69234c7543183f8ab98 (diff)
waitpid should specify WNOHANG
If the child process our terminal is executing behaves poorly and doesn't waitpid all of its own children, then we can hang the full terminal. This is not ideal, so specify WNOHANG.
Diffstat (limited to 'src/Command.zig')
-rw-r--r--src/Command.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Command.zig b/src/Command.zig
index 121b91a45..1e63d9161 100644
--- a/src/Command.zig
+++ b/src/Command.zig
@@ -186,7 +186,10 @@ fn setupFd(src: File.Handle, target: i32) !void {
/// Wait for the command to exit and return information about how it exited.
pub fn wait(self: Command) !Exit {
- const res = std.os.waitpid(self.pid.?, 0);
+ // We specify NOHANG because its not our fault if the process we launch
+ // for the tty doesn't properly waitpid its children. We don't want
+ // to hang the terminal over it.
+ const res = std.os.waitpid(self.pid.?, std.c.W.NOHANG);
return Exit.init(res.status);
}