Skip to main content

NativePtyProcess

Struct NativePtyProcess 

Source
pub struct NativePtyProcess {
Show 15 fields pub argv: Vec<String>, pub cwd: Option<String>, pub env: Option<Vec<(String, String)>>, pub rows: u16, pub cols: u16, pub handles: Arc<Mutex<Option<NativePtyHandles>>>, pub reader: Arc<PtyReadShared>, pub returncode: Arc<Mutex<Option<i32>>>, pub input_bytes_total: Arc<AtomicUsize>, pub newline_events_total: Arc<AtomicUsize>, pub submit_events_total: Arc<AtomicUsize>, pub echo: Arc<AtomicBool>, pub idle_detector: Arc<Mutex<Option<Arc<IdleDetectorCore>>>>, pub output_bytes_total: Arc<AtomicUsize>, pub control_churn_bytes_total: Arc<AtomicUsize>,
}

Fields§

§argv: Vec<String>§cwd: Option<String>§env: Option<Vec<(String, String)>>§rows: u16§cols: u16§handles: Arc<Mutex<Option<NativePtyHandles>>>§reader: Arc<PtyReadShared>§returncode: Arc<Mutex<Option<i32>>>§input_bytes_total: Arc<AtomicUsize>§newline_events_total: Arc<AtomicUsize>§submit_events_total: Arc<AtomicUsize>§echo: Arc<AtomicBool>

When true, the reader thread writes PTY output to stdout.

§idle_detector: Arc<Mutex<Option<Arc<IdleDetectorCore>>>>

When set, the reader thread feeds output directly to the idle detector.

§output_bytes_total: Arc<AtomicUsize>

Visible (non-control) output bytes seen by the reader thread.

§control_churn_bytes_total: Arc<AtomicUsize>

Control churn bytes (ANSI escapes, BS, CR, DEL) seen by the reader.

Implementations§

Source§

impl NativePtyProcess

Source

pub fn new( argv: Vec<String>, cwd: Option<String>, env: Option<Vec<(String, String)>>, rows: u16, cols: u16, nice: Option<i32>, ) -> Result<Self, PtyError>

Source

pub fn mark_reader_closed(&self)

Source

pub fn store_returncode(&self, code: i32)

Source

pub fn record_input_metrics(&self, data: &[u8], submit: bool)

Source

pub fn write_impl(&self, data: &[u8], submit: bool) -> Result<(), PtyError>

Source

pub fn stop_terminal_input_relay_impl(&self)

Source

pub fn close_impl(&self) -> Result<(), PtyError>

Synchronously tear down the PTY and reap the child.

Source

pub fn close_nonblocking(&self)

Best-effort, non-blocking teardown for use from Drop.

Source

pub fn start_impl(&self) -> Result<(), PtyError>

Source

pub fn respond_to_queries_impl(&self, data: &[u8]) -> Result<(), PtyError>

Source

pub fn resize_impl(&self, rows: u16, cols: u16) -> Result<(), PtyError>

Source

pub fn send_interrupt_impl(&self) -> Result<(), PtyError>

Source

pub fn wait_impl(&self, timeout: Option<f64>) -> Result<i32, PtyError>

Source

pub fn terminate_impl(&self) -> Result<(), PtyError>

Source

pub fn kill_impl(&self) -> Result<(), PtyError>

Source

pub fn terminate_tree_impl(&self) -> Result<(), PtyError>

Source

pub fn kill_tree_impl(&self) -> Result<(), PtyError>

Source

pub fn pid(&self) -> Result<Option<u32>, PtyError>

Get the PID of the child process, if running.

Source

pub fn read_chunk_impl( &self, timeout: Option<f64>, ) -> Result<Option<Vec<u8>>, PtyError>

Wait for a chunk of output from the PTY reader. Returns Ok(Some(chunk)) on data, Ok(None) on timeout, Err on closed.

Source

pub fn wait_for_reader_closed_impl(&self, timeout: Option<f64>) -> bool

Wait for the reader thread to close.

Source

pub fn wait_and_drain_impl( &self, timeout: Option<f64>, drain_timeout: f64, ) -> Result<i32, PtyError>

Wait for exit then drain remaining output.

Source

pub fn set_echo(&self, enabled: bool)

Source

pub fn echo_enabled(&self) -> bool

Source

pub fn attach_idle_detector(&self, detector: &Arc<IdleDetectorCore>)

Source

pub fn detach_idle_detector(&self)

Source

pub fn pty_input_bytes_total(&self) -> usize

Source

pub fn pty_newline_events_total(&self) -> usize

Source

pub fn pty_submit_events_total(&self) -> usize

Source

pub fn pty_output_bytes_total(&self) -> usize

Source

pub fn pty_control_churn_bytes_total(&self) -> usize

Trait Implementations§

Source§

impl Drop for NativePtyProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.