Skip to content

Instantly share code, notes, and snippets.

@quux00
Created February 9, 2014 16:30
Show Gist options
  • Save quux00/8901618 to your computer and use it in GitHub Desktop.
Save quux00/8901618 to your computer and use it in GitHub Desktop.
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