diff options
author | Andrew Borg (Kashin) <1192958+aborg-dev@users.noreply.github.com> | 2025-01-16 15:04:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-16 15:04:21 +0000 |
commit | 5e78d20c709cb1ab8d44ca7a8702cc26d779227c (patch) | |
tree | f5174dfb36771fbfb149b338f000ab27c119baab /alacritty_terminal/src | |
parent | c9c41e637ac49f3cd67cf0362c596ae9d947f896 (diff) | |
download | r-alacritty-5e78d20c709cb1ab8d44ca7a8702cc26d779227c.tar.gz r-alacritty-5e78d20c709cb1ab8d44ca7a8702cc26d779227c.tar.bz2 r-alacritty-5e78d20c709cb1ab8d44ca7a8702cc26d779227c.zip |
Add option to drain PTY on shutdown
This patch removes the `hold` option on `alacritty_terminal` in favor of
a `drain_on_exit` option, which will drain the PTY before shutdown. The
hold logic is instead handled in `alacritty`.
Diffstat (limited to 'alacritty_terminal/src')
-rw-r--r-- | alacritty_terminal/src/event_loop.rs | 13 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/mod.rs | 4 |
2 files changed, 7 insertions, 10 deletions
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs index 2b78f853..1bef1d4f 100644 --- a/alacritty_terminal/src/event_loop.rs +++ b/alacritty_terminal/src/event_loop.rs @@ -50,7 +50,7 @@ pub struct EventLoop<T: tty::EventedPty, U: EventListener> { tx: Sender<Msg>, terminal: Arc<FairMutex<Term<U>>>, event_proxy: U, - hold: bool, + drain_on_exit: bool, ref_test: bool, } @@ -64,7 +64,7 @@ where terminal: Arc<FairMutex<Term<U>>>, event_proxy: U, pty: T, - hold: bool, + drain_on_exit: bool, ref_test: bool, ) -> io::Result<EventLoop<T, U>> { let (tx, rx) = mpsc::channel(); @@ -76,7 +76,7 @@ where rx: PeekableReceiver::new(rx), terminal, event_proxy, - hold, + drain_on_exit, ref_test, }) } @@ -261,13 +261,10 @@ where if let Some(code) = code { self.event_proxy.send_event(Event::ChildExit(code)); } - if self.hold { - // With hold enabled, make sure the PTY is drained. + if self.drain_on_exit { let _ = self.pty_read(&mut state, &mut buf, pipe.as_mut()); - } else { - // Without hold, shutdown the terminal. - self.terminal.lock().exit(); } + self.terminal.lock().exit(); self.event_proxy.send_event(Event::Wakeup); break 'event_loop; } diff --git a/alacritty_terminal/src/tty/mod.rs b/alacritty_terminal/src/tty/mod.rs index eed2a76d..208547ba 100644 --- a/alacritty_terminal/src/tty/mod.rs +++ b/alacritty_terminal/src/tty/mod.rs @@ -28,8 +28,8 @@ pub struct Options { /// Shell startup directory. pub working_directory: Option<PathBuf>, - /// Remain open after child process exits. - pub hold: bool, + /// Drain the child process output before exiting the terminal. + pub drain_on_exit: bool, /// Extra environment variables. pub env: HashMap<String, String>, |