Created
February 9, 2014 16:30
-
-
Save quux00/8901618 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::process; | |
use std::io::process::{Process, ProcessConfig}; | |
use std::comm::{Port, Chan}; | |
fn main() { | |
let (port, chan) = Chan::new(); | |
spawn(proc(){taskEntry(port)}); | |
chan.send(~"ls"); | |
} | |
fn taskEntry(port : Port<~str>) { | |
let name = port.recv(); | |
let res = Process::new(ProcessConfig{program: name, args: [], env: None, cwd: None, | |
io: [process::Ignored, process::InheritFd(1), process::Ignored]}); | |
let mut process; | |
match res { | |
Some(id) => process = id, | |
None() => fail!("wat") | |
} | |
process.wait(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment