[][src]Struct pwner::process::Process

pub struct 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.

Methods

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]

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) -> 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() {
    println!("Child's ID is {}", child.id());
} else {
    println!("ls command didn't start");
}

impl Read for Process[src]

impl Write for Process[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.