1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-08-07 22:12:25 -04:00

Fix signal handling on Unix systems

This removes the the signal handling machinery in tty::unix, and
replaces it with functionality from signal-hook, which should be more
robust. Signals caught by signal-hook wake up the existing I/O event
loop, which then delegates back to the PTY to handle them.

In particular, this allows `SIGCHLD` (i.e. child process exits) to shut
down the terminal promptly, instead of sometimes leaving the window
lingering.

Fixes #915.
Fixes #1276.
Fixes #1313.

As a side effect, this fixes a very rare bug on Linux, where a `read`
from the PTY on the master side would sometimes "fail" with `EIO` if the
child closed the client side at a particular moment. This was subject to
a race condition, and was very difficult to trigger in practice.
This commit is contained in:
Rachel K 2019-03-12 19:44:47 +00:00 committed by Christian Duerr
parent e240da9ab3
commit 62c1d999e1
10 changed files with 207 additions and 134 deletions

View file

@ -51,6 +51,10 @@ url = "1.7.1"
time = "0.1.40"
crossbeam-channel = "0.3.8"
[target.'cfg(unix)'.dependencies]
nix = "0.12"
signal-hook = { version = "0.1", features = ["mio-support"] }
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="openbsd"))'.dependencies]
x11-dl = "2"