diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-05-05 22:50:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 22:50:23 +0000 |
commit | 81ce93574f62d4b117fdd79af65391f30316a457 (patch) | |
tree | 951a0578860c6028e2dfff0ca83879001c6b2385 /alacritty_terminal/src/tty/windows/conpty.rs | |
parent | 04f0bcaf54ed373128ca0f84ee8fcdd8e52bce23 (diff) | |
download | alacritty-81ce93574f62d4b117fdd79af65391f30316a457.tar.gz alacritty-81ce93574f62d4b117fdd79af65391f30316a457.zip |
Extend style guideline documentation
Diffstat (limited to 'alacritty_terminal/src/tty/windows/conpty.rs')
-rw-r--r-- | alacritty_terminal/src/tty/windows/conpty.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs index 99d52b05..2056f3d6 100644 --- a/alacritty_terminal/src/tty/windows/conpty.rs +++ b/alacritty_terminal/src/tty/windows/conpty.rs @@ -42,7 +42,7 @@ use crate::tty::windows::{cmdline, win32_string, Pty}; // done until a safety net is in place for versions of Windows // that do not support the ConPTY api, as such versions will // pass unit testing - but fail to actually function. -/// Dynamically-loaded Pseudoconsole API from kernel32.dll +/// Dynamically-loaded Pseudoconsole API from kernel32.dll. /// /// The field names are deliberately PascalCase as this matches /// the defined symbols in kernel32 and also is the convention @@ -58,7 +58,7 @@ struct ConptyApi { impl ConptyApi { /// Load the API or None if it cannot be found. pub fn new() -> Option<Self> { - // Unsafe because windows API calls + // Unsafe because windows API calls. unsafe { let hmodule = GetModuleHandleA("kernel32\0".as_ptr() as _); assert!(!hmodule.is_null()); @@ -80,7 +80,7 @@ impl ConptyApi { } } -/// RAII Pseudoconsole +/// RAII Pseudoconsole. pub struct Conpty { pub handle: HPCON, api: ConptyApi, @@ -91,12 +91,12 @@ impl Drop for Conpty { // XXX: This will block until the conout pipe is drained. Will cause a deadlock if the // conout pipe has already been dropped by this point. // - // See PR #3084 and https://docs.microsoft.com/en-us/windows/console/closepseudoconsole + // See PR #3084 and https://docs.microsoft.com/en-us/windows/console/closepseudoconsole. unsafe { (self.api.ClosePseudoConsole)(self.handle) } } } -// The Conpty handle can be sent between threads. +// The ConPTY handle can be sent between threads. unsafe impl Send for Conpty {} pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Option<Pty> { @@ -118,7 +118,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> let coord = coord_from_sizeinfo(size).expect("Overflow when creating initial size on pseudoconsole"); - // Create the Pseudo Console, using the pipes + // Create the Pseudo Console, using the pipes. let result = unsafe { (api.CreatePseudoConsole)( coord, @@ -133,7 +133,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> let mut success; - // Prepare child process startup info + // Prepare child process startup info. let mut size: SIZE_T = 0; @@ -145,7 +145,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> 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. + // 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. @@ -185,12 +185,12 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> } } - // Set thread attribute list's Pseudo Console to the specified ConPTY + // Set thread attribute list's Pseudo Console to the specified ConPTY. unsafe { success = UpdateProcThreadAttribute( startup_info_ex.lpAttributeList, 0, - 22 | 0x0002_0000, // PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE + 22 | 0x0002_0000, // PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE. pty_handle, mem::size_of::<HPCON>(), ptr::null_mut(), @@ -242,7 +242,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> }) } -// Panic with the last os error as message +// Panic with the last os error as message. fn panic_shell_spawn() { panic!("Unable to spawn shell: {}", Error::last_os_error()); } |