aboutsummaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorDavid Hewitt <1939362+davidhewitt@users.noreply.github.com>2019-03-04 22:58:03 +0000
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-03-04 22:58:03 +0000
commit9ba7c4fae4d927e109c7981f7e11ca7acdc14eb3 (patch)
tree1ed4da74bf1e3b8d3fbc6a01ae4f4eae23d196e0 /src/tty
parentba9aaa05396aa1c9961d9c35bfb90106326d4411 (diff)
downloadr-alacritty-9ba7c4fae4d927e109c7981f7e11ca7acdc14eb3.tar.gz
r-alacritty-9ba7c4fae4d927e109c7981f7e11ca7acdc14eb3.tar.bz2
r-alacritty-9ba7c4fae4d927e109c7981f7e11ca7acdc14eb3.zip
Make start_daemon behaviour on Windows consistent with Unix
In cases where the Alacritty process had invalid std handles then the ConPTY subprocess would fail to spawn. By setting appropriate flags we prevent these handles from being passed to the ConPTY subprocess.
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/windows/conpty.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tty/windows/conpty.rs b/src/tty/windows/conpty.rs
index f3c6cf5b..372685d6 100644
--- a/src/tty/windows/conpty.rs
+++ b/src/tty/windows/conpty.rs
@@ -34,7 +34,7 @@ use winapi::um::processthreadsapi::{
CreateProcessW, InitializeProcThreadAttributeList, UpdateProcThreadAttribute,
PROCESS_INFORMATION, STARTUPINFOW,
};
-use winapi::um::winbase::{EXTENDED_STARTUPINFO_PRESENT, STARTUPINFOEXW};
+use winapi::um::winbase::{EXTENDED_STARTUPINFO_PRESENT, STARTF_USESTDHANDLES, STARTUPINFOEXW};
use winapi::um::wincon::COORD;
use crate::cli::Options;
@@ -149,6 +149,10 @@ pub fn new<'a>(
let mut startup_info_ex: STARTUPINFOEXW = Default::default();
startup_info_ex.StartupInfo.cb = mem::size_of::<STARTUPINFOEXW>() as u32;
+ // Setting this flag but leaving all the handles as default (null) ensures the
+ // pty process does not inherit any handles from this Alacritty process.
+ startup_info_ex.StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
+
// Create the appropriately sized thread attribute list.
unsafe {
success =
@@ -226,7 +230,7 @@ pub fn new<'a>(
cmdline as LPWSTR,
ptr::null_mut(),
ptr::null_mut(),
- true as i32,
+ false as i32,
EXTENDED_STARTUPINFO_PRESENT,
ptr::null_mut(),
cwd_ptr,