summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Holecek <hluk@email.cz>2017-03-14 08:39:20 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-04-03 21:34:06 -0700
commit52c979bc0843dc2b820db97aaff8b58b6ad9d675 (patch)
tree4f6a4778823dc0d7d0ba60d54c7ad5278df17143 /src
parent4dcd7c4c0de86ee957b26a5fe1874404033f298b (diff)
Fix hang on exit after child process failed
Quick test (works ~50%) is to press Ctrl+C followed by Ctrl+D. Reproducible on Arch Linux with OpenGL from NVidia. Fixes #228
Diffstat (limited to 'src')
-rw-r--r--src/tty.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/tty.rs b/src/tty.rs
index 7623abdc..eb0ba590 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -21,7 +21,7 @@ use std::os::unix::process::CommandExt;
use std::ptr;
use std::process::{Command, Stdio};
-use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD, TIOCSCTTY};
+use libc::{self, winsize, c_int, pid_t, WNOHANG, SIGCHLD, TIOCSCTTY};
use term::SizeInfo;
use display::OnResize;
@@ -48,15 +48,9 @@ extern "C" fn sigchld(_a: c_int) {
die!("Waiting for pid {} failed: {}\n", PID, errno());
}
- if PID != p {
- return;
+ if PID == p {
+ SHOULD_EXIT = true;
}
-
- if !WIFEXITED(status) || WEXITSTATUS(status) != 0 {
- die!("child finished with error '{}'\n", status);
- }
-
- SHOULD_EXIT = true;
}
}