From 6d1a63ef28d18168ed4ca0d6a8c3413cb4621ca5 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sat, 18 Dec 2021 22:18:42 +0000 Subject: Remove shared PID/FD variables The existing PID/FD atomics in alacritty_terminal/src/tty/unix.rs were shared across all Alacritty windows, causing problem with the new multiwindow feature. Instead of sharing these between the different windows, the master FD and shell PID are now stored on the `window_context`. Unfortunately this makes spawning new daemons a little more complicated, having to pass through additional parameters. To ease this a little bit the helper method `spawn_daemon` has been defined on the `ActionContext`, making it accessible from most parts of Alacritty's event loop. Fixes #5700. --- alacritty/src/input.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'alacritty/src/input.rs') diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 07b3154c..40b18ca2 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -7,6 +7,8 @@ use std::borrow::Cow; use std::cmp::{max, min, Ordering}; +use std::ffi::OsStr; +use std::fmt::Debug; use std::marker::PhantomData; use std::time::{Duration, Instant}; @@ -30,7 +32,6 @@ use alacritty_terminal::vi_mode::ViMotion; use crate::clipboard::Clipboard; use crate::config::{Action, BindingMode, Key, MouseAction, SearchAction, UiConfig, ViAction}; -use crate::daemon::start_daemon; use crate::display::hint::HintMatch; use crate::display::window::Window; use crate::display::Display; @@ -107,6 +108,12 @@ pub trait ActionContext { fn trigger_hint(&mut self, _hint: &HintMatch) {} fn expand_selection(&mut self) {} fn paste(&mut self, _text: &str) {} + fn spawn_daemon(&self, _program: &str, _args: I) + where + I: IntoIterator + Debug + Copy, + S: AsRef, + { + } } impl Action { @@ -139,7 +146,7 @@ impl Execute for Action { ctx.scroll(Scroll::Bottom); ctx.write_to_pty(s.clone().into_bytes()) }, - Action::Command(program) => start_daemon(program.program(), program.args()), + Action::Command(program) => ctx.spawn_daemon(program.program(), program.args()), Action::Hint(hint) => { ctx.display().hint_state.start(hint.clone()); ctx.mark_dirty(); -- cgit