diff options
Diffstat (limited to 'src/tty/windows/mod.rs')
-rw-r--r-- | src/tty/windows/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tty/windows/mod.rs b/src/tty/windows/mod.rs index ae228bf3..5e0aee84 100644 --- a/src/tty/windows/mod.rs +++ b/src/tty/windows/mod.rs @@ -14,6 +14,7 @@ use std::io::{self, Read, Write}; use std::os::raw::c_void; +use std::sync::atomic::{AtomicBool, Ordering}; use mio::{self, Evented, Poll, PollOpt, Ready, Token}; use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite}; @@ -34,6 +35,7 @@ mod winpty; /// Handle to the winpty agent or conpty process. Required so we know when it closes. static mut HANDLE: *mut c_void = 0usize as *mut c_void; +static IS_CONPTY: AtomicBool = AtomicBool::new(false); pub fn process_should_exit() -> bool { unsafe { @@ -54,6 +56,10 @@ pub fn process_should_exit() -> bool { } } +pub fn is_conpty() -> bool { + IS_CONPTY.load(Ordering::Relaxed) +} + #[derive(Clone)] pub enum PtyHandle<'a> { Winpty(winpty::WinptyHandle<'a>), @@ -86,6 +92,7 @@ pub fn new<'a>( ) -> Pty<'a> { if let Some(pty) = conpty::new(config, options, size, window_id) { info!("Using Conpty agent"); + IS_CONPTY.store(true, Ordering::Relaxed); pty } else { info!("Using Winpty agent"); |