diff options
author | Valentin Ignatev <valentignatev@gmail.com> | 2019-10-10 00:37:48 +0300 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2019-10-09 23:37:48 +0200 |
commit | 4cb5566a9c2d68006ffa97e2f8082ae3ef6c8de4 (patch) | |
tree | f8cccdab59503d791b9fb44d0b9b5fb3ee3b1b85 /alacritty_terminal/src/event_loop.rs | |
parent | 24651a6144e5071f0a72d991734a9b380255156e (diff) | |
download | alacritty-4cb5566a9c2d68006ffa97e2f8082ae3ef6c8de4.tar.gz alacritty-4cb5566a9c2d68006ffa97e2f8082ae3ef6c8de4.zip |
Add --hold CLI flag
This implements --hold flag which keeps Alacritty open after
its child process exits.
Fixes #1165.
Diffstat (limited to 'alacritty_terminal/src/event_loop.rs')
-rw-r--r-- | alacritty_terminal/src/event_loop.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs index ed78d79e..3e762840 100644 --- a/alacritty_terminal/src/event_loop.rs +++ b/alacritty_terminal/src/event_loop.rs @@ -13,6 +13,7 @@ use mio::{self, Events, PollOpt, Ready}; use mio_extras::channel::{self, Receiver, Sender}; use crate::ansi; +use crate::config::Config; use crate::event::{self, Event, EventListener}; use crate::sync::FairMutex; use crate::term::Term; @@ -43,6 +44,7 @@ pub struct EventLoop<T: tty::EventedPty, U: EventListener> { tx: Sender<Msg>, terminal: Arc<FairMutex<Term<U>>>, event_proxy: U, + hold: bool, ref_test: bool, } @@ -143,11 +145,11 @@ where U: EventListener + Send + 'static, { /// Create a new event loop - pub fn new( + pub fn new<V>( terminal: Arc<FairMutex<Term<U>>>, event_proxy: U, pty: T, - ref_test: bool, + config: &Config<V>, ) -> EventLoop<T, U> { let (tx, rx) = channel::channel(); EventLoop { @@ -157,7 +159,8 @@ where rx, terminal, event_proxy, - ref_test, + hold: config.hold, + ref_test: config.debug.ref_test, } } @@ -327,7 +330,9 @@ where #[cfg(unix)] token if token == self.pty.child_event_token() => { if let Some(tty::ChildEvent::Exited) = self.pty.next_child_event() { - self.terminal.lock().exit(); + if !self.hold { + self.terminal.lock().exit(); + } self.event_proxy.send_event(Event::Wakeup); break 'event_loop; } |