Process spawning
Program
- A value representing a child processprogram_output
- Spawns a process, waits for it to exit, and returns the exit code, and contents of stdout and stderr.read_all
readclose
run_program
- Spawns a process and waits for it to terminatespawn_process
- Run a program, providing stdin, stdout and stderr handlesstart_program
- Spawns a process and returns a programwaitpid
- Waits for a process to exit and returns the exit codewith_argv
with_dirp
with_envp
writeclose
run::rustrt
Program
A value representing a child process
get_id
fn get_id() -> pid_t
Returns the process id of the program
input
fn input() -> io::Writer
Returns an io::writer that can be used to write to stdin
output
fn output() -> io::Reader
Returns an io::reader that can be used to read from stdout
err
fn err() -> io::Reader
Returns an io::reader that can be used to read from stderr
close_input
fn close_input()
Closes the handle to the child processes standard input
finish
fn finish() -> int
Waits for the child process to terminate. Closes the handle to stdin if necessary.
destroy
fn destroy()
Closes open handles
program_output
fn program_output(prog: &str, args: &[~str]) ->
{status: int, out: ~str, err: ~str,}
Spawns a process, waits for it to exit, and returns the exit code, and contents of stdout and stderr.
A record, {status: int, out: str, err: str} containing the exit code, the contents of stdout and the contents of stderr.
read_all
fn read_all(rd: io::Reader) -> ~str
readclose
fn readclose(fd: c_int) -> ~str
run_program
fn run_program(prog: &str, args: &[~str]) -> int
Spawns a process and waits for it to terminate
The process id
spawn_process
fn spawn_process(prog: &str, args: &[~str], env: &Option<~[(~str, ~str)]>,
dir: &Option<~str>, in_fd: c_int, out_fd: c_int,
err_fd: c_int) -> pid_t
Run a program, providing stdin, stdout and stderr handles
The process id of the spawned process
start_program
fn start_program(prog: &str, args: &[~str]) -> Program
Spawns a process and returns a program
The returned value is a boxed class containing a
A class with a
waitpid
fn waitpid(pid: pid_t) -> int
Waits for a process to exit and returns the exit code
with_argv
fn with_argv<T>(prog: &str, args: &[~str], cb: &fn(**libc::c_char) -> T) -> T
with_dirp
fn with_dirp<T>(d: &Option<~str>, cb: &fn(*libc::c_char) -> T) -> T
with_envp
fn with_envp<T>(env: &Option<~[(~str, ~str)]>, cb: &fn(*c_void) -> T) -> T
writeclose
fn writeclose(fd: c_int, s: ~str)