use fmt; use io; use os::exec; use os; use strings; export fn main() void = { let cmd = exec::cmd("./run.sh")!; let stdout_pipe = exec::pipe(); exec::addfile(&cmd, os::stdout_file, stdout_pipe.1); let stderr_pipe = exec::pipe(); exec::addfile(&cmd, os::stderr_file, stderr_pipe.1); let proc = exec::start(&cmd)!; io::close(stdout_pipe.1)!; io::close(stderr_pipe.1)!; let stdout_data = io::drain(stdout_pipe.0)!; io::close(stdout_pipe.0)!; let stderr_data = io::drain(stderr_pipe.0)!; io::close(stderr_pipe.0)!; let status = exec::wait(&proc)!; let s = exec::exit(&status) as int; fmt::printfln("status: {}", s)!; let out = strings::fromutf8(stdout_data) as str; fmt::printfln("stdout:\n{}", out)!; let out = strings::fromutf8(stderr_data) as str; fmt::printfln("stderr:\n{}", out)!; };