Closed
Description
use std::{io, os, run, str};
fn main() {
let cwd = os::getcwd();
let mut prog = run::Process::new("echo",
[~"eggplants"],
run::ProcessOptions { env: None,
dir: Some(&cwd),
in_fd: None,
out_fd: None,
err_fd: None
});
let rslt = prog.finish_with_output();
io::println(fmt!("status = %?; output = %s", rslt.status, str::from_bytes(rslt.output)));
assert_eq!(str::from_bytes(rslt.output), ~"eggplants\n");
let mut prog = run::Process::new("echo",
[~"$EGGPLANTS"],
run::ProcessOptions { env: Some(&[(~"EGGPLANTS",
~"17")]),
dir: Some(&cwd),
in_fd: None,
out_fd: None,
err_fd: None
});
let rslt = prog.finish_with_output();
io::println(fmt!("status = %?; output = %s", rslt.status, str::from_bytes(rslt.output)));
assert_eq!(str::from_bytes(rslt.output), ~"17");
}
The second assertion fails. Also, the "echo" process fails with exit code 1. Something about putting a Some(...)
in the env
field is breaking process spawning.
This is on Mac OS X; I don't know about other platforms.
Metadata
Metadata
Assignees
Labels
No labels