diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-07-30 22:13:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-30 22:13:51 +0000 |
commit | 86b9cdbabe495effed3559d2561f65efab9becaa (patch) | |
tree | 83577b53d79de856697d116d9a4062025f27b561 /alacritty_terminal/src | |
parent | 72dfa477a9785289931e8e05dfc8244bb6a4e81c (diff) | |
download | alacritty-86b9cdbabe495effed3559d2561f65efab9becaa.tar.gz alacritty-86b9cdbabe495effed3559d2561f65efab9becaa.zip |
Bump minimum supported Rust version to 1.34.0
Diffstat (limited to 'alacritty_terminal/src')
-rw-r--r-- | alacritty_terminal/src/input.rs | 1 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/unix.rs | 23 | ||||
-rw-r--r-- | alacritty_terminal/src/util.rs | 46 |
3 files changed, 33 insertions, 37 deletions
diff --git a/alacritty_terminal/src/input.rs b/alacritty_terminal/src/input.rs index 92e08af5..9443a1a9 100644 --- a/alacritty_terminal/src/input.rs +++ b/alacritty_terminal/src/input.rs @@ -1074,6 +1074,7 @@ mod tests { assert!(!subset_mods.triggers_match(&superset_mods)); } + #[test] fn binding_trigger_input() { let mut binding = MockBinding::default(); binding.trigger = 13; diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs index cafa7027..f4c5771f 100644 --- a/alacritty_terminal/src/tty/unix.rs +++ b/alacritty_terminal/src/tty/unix.rs @@ -194,35 +194,30 @@ pub fn new<T: ToWinsize>(config: &Config, size: &T, window_id: Option<usize>) -> builder.env("WINDOWID", format!("{}", window_id)); } - // TODO: Rust 1.34.0 - #[allow(deprecated)] - builder.before_exec(move || { - // Create a new process group - unsafe { + unsafe { + builder.pre_exec(move || { + // Create a new process group let err = libc::setsid(); if err == -1 { die!("Failed to set session id: {}", errno()); } - } - set_controlling_terminal(slave); + set_controlling_terminal(slave); - // No longer need slave/master fds - unsafe { + // No longer need slave/master fds libc::close(slave); libc::close(master); - } - unsafe { libc::signal(libc::SIGCHLD, libc::SIG_DFL); libc::signal(libc::SIGHUP, libc::SIG_DFL); libc::signal(libc::SIGINT, libc::SIG_DFL); libc::signal(libc::SIGQUIT, libc::SIG_DFL); libc::signal(libc::SIGTERM, libc::SIG_DFL); libc::signal(libc::SIGALRM, libc::SIG_DFL); - } - Ok(()) - }); + + Ok(()) + }); + } // Handle set working directory option if let Some(ref dir) = config.working_directory() { diff --git a/alacritty_terminal/src/util.rs b/alacritty_terminal/src/util.rs index 45b17353..7bc7c08b 100644 --- a/alacritty_terminal/src/util.rs +++ b/alacritty_terminal/src/util.rs @@ -87,29 +87,29 @@ where I: IntoIterator<Item = S>, S: AsRef<OsStr>, { - // TODO: Rust 1.34.0 - #[allow(deprecated)] - Command::new(program) - .args(args) - .stdin(Stdio::null()) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .before_exec(|| unsafe { - match ::libc::fork() { - -1 => return Err(io::Error::last_os_error()), - 0 => (), - _ => ::libc::_exit(0), - } - - if ::libc::setsid() == -1 { - return Err(io::Error::last_os_error()); - } - - Ok(()) - }) - .spawn()? - .wait() - .map(|_| ()) + unsafe { + Command::new(program) + .args(args) + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .pre_exec(|| { + match ::libc::fork() { + -1 => return Err(io::Error::last_os_error()), + 0 => (), + _ => ::libc::_exit(0), + } + + if ::libc::setsid() == -1 { + return Err(io::Error::last_os_error()); + } + + Ok(()) + }) + .spawn()? + .wait() + .map(|_| ()) + } } #[cfg(windows)] |