2016-09-07 00:13:11 -07:00
|
|
|
extern crate tokio_core;
|
|
|
|
|
extern crate tokio_process;
|
|
|
|
|
|
2016-12-18 22:36:21 -08:00
|
|
|
use tokio_core::reactor::Core;
|
|
|
|
|
use tokio_process::CommandExt;
|
2016-09-07 00:13:11 -07:00
|
|
|
|
2016-12-18 22:48:18 -08:00
|
|
|
mod support;
|
2016-09-07 00:13:11 -07:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn simple() {
|
2016-09-07 22:15:13 -07:00
|
|
|
let mut lp = Core::new().unwrap();
|
2016-12-18 22:48:18 -08:00
|
|
|
let mut cmd = support::cmd("exit");
|
2016-09-07 00:13:11 -07:00
|
|
|
cmd.arg("2");
|
2016-12-18 22:36:21 -08:00
|
|
|
let mut child = cmd.spawn_async(&lp.handle()).unwrap();
|
2016-09-07 00:13:11 -07:00
|
|
|
let id = child.id();
|
|
|
|
|
assert!(id > 0);
|
|
|
|
|
let status = lp.run(&mut child).unwrap();
|
|
|
|
|
assert_eq!(status.code(), Some(2));
|
|
|
|
|
assert_eq!(child.id(), id);
|
2016-09-07 12:59:46 -07:00
|
|
|
drop(child.kill());
|
2016-09-07 00:13:11 -07:00
|
|
|
}
|