pub struct PTYProcess { /* private fields */ }Expand description
This struct handles the I/O operations to the standard streams, as well the lifetime of a process running inside a PTY.
Implementations§
Source§impl PTYProcess
impl PTYProcess
Sourcepub fn new(
conin: LocalHandle,
conout: LocalHandle,
using_pipes: bool,
async_: bool,
cleanup_tx: Option<Sender<bool>>,
) -> PTYProcess
pub fn new( conin: LocalHandle, conout: LocalHandle, using_pipes: bool, async_: bool, cleanup_tx: Option<Sender<bool>>, ) -> PTYProcess
Create a new PTYProcess instance.
§Arguments
conin- Handle to the process standard input streamconout- Handle to the process standard output streamusing_pipes-trueif the streams are Windows named pipes,falseif they are files.async_-trueif the streams are async,falseif they are sync.
§Returns
pty- A newPTYProcessinstance.
Sourcepub fn read(&self, blocking: bool) -> Result<OsString, OsString>
pub fn read(&self, blocking: bool) -> Result<OsString, OsString>
Read from the process standard output.
§Arguments
blocking- If true, wait for data to be available. If false, return immediately if no data is available.
§Returns
Ok(OsString)- The data read from the process outputErr(OsString)- If EOF is reached or an error occurs
§Notes
- The actual read operation happens in a background thread with a fixed buffer size
- The returned data is represented using a
OsStringsince Windows operates overu16strings
Sourcepub fn get_exitstatus(&self) -> Result<Option<u32>, OsString>
pub fn get_exitstatus(&self) -> Result<Option<u32>, OsString>
Retrieve the exit status of the process
§Returns
None if the process has not exited, else the exit code of the process.
Sourcepub fn set_process(&mut self, process: HANDLE, close_process: bool)
pub fn set_process(&mut self, process: HANDLE, close_process: bool)
Set the running process behind the PTY.
Sourcepub fn wait_for_exit(&self) -> Result<bool, OsString>
pub fn wait_for_exit(&self) -> Result<bool, OsString>
Wait for the process to exit
Trait Implementations§
Source§impl Drop for PTYProcess
impl Drop for PTYProcess
Auto Trait Implementations§
impl !RefUnwindSafe for PTYProcess
impl !Send for PTYProcess
impl !Sync for PTYProcess
impl !UnwindSafe for PTYProcess
impl Freeze for PTYProcess
impl Unpin for PTYProcess
impl UnsafeUnpin for PTYProcess
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more