[−][src]Struct pwner::process::Process
An implementation of Process
that uses std::process
as the launcher.
All read and write operations are sync.
Note: On *nix platforms, the owned process will have 2 seconds between signals, which is a blocking wait.
Implementations
impl Process
[src]
pub fn read_from(&mut self, read_source: ReadSource) -> &mut Self
[src]
Choose which pipe to read form next.
Examples
Basic usage:
use std::io::Read; use std::process::Command; use pwner::Spawner; use pwner::process::ReadSource; let mut child = Command::new("ls").spawn_owned().unwrap(); let mut buffer = [0_u8; 1024]; child.read_from(ReadSource::Stdout).read(&mut buffer).unwrap();
pub fn decompose(
&mut self
) -> (&mut ChildStdin, &mut ChildStdout, &mut ChildStderr)
[src]
&mut self
) -> (&mut ChildStdin, &mut ChildStdout, &mut ChildStderr)
Decomposes the handle into mutable references to the pipes.
Examples
Basic usage:
use std::io::{ Read, Write }; use std::process::Command; use pwner::Spawner; let mut child = Command::new("cat").spawn_owned().unwrap(); let mut buffer = [0_u8; 1024]; let (stdin, stdout, _) = child.decompose(); stdin.write_all(b"hello\n").unwrap(); stdout.read(&mut buffer).unwrap();
Trait Implementations
impl Drop for Process
[src]
impl Process for Process
[src]
#[must_use]fn id(&self) -> Option<u32>
[src]
Returns the OS-assigned process identifier associated with this child.
Examples
Basic usage:
use std::process::Command; use pwner::{ Spawner, Process }; let mut command = Command::new("ls"); if let Ok(child) = command.spawn_owned() { match child.id() { Some(pid) => println!("Child's ID is {}", pid), None => println!("Child has already exited"), } } else { println!("ls command didn't start"); }
impl Read for Process
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
1.36.0[src]
fn is_read_vectored(&self) -> bool
[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Write for Process
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
1.36.0[src]
fn is_write_vectored(&self) -> bool
[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
[src]
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for Process
impl Send for Process
impl Sync for Process
impl Unpin for Process
impl UnwindSafe for Process
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,