Files
tokio/tests/smoke.rs
T

24 lines
460 B
Rust
Raw Normal View History

extern crate tokio_current_thread;
2016-09-07 00:13:11 -07:00
extern crate tokio_process;
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-12-18 22:48:18 -08:00
let mut cmd = support::cmd("exit");
2016-09-07 00:13:11 -07:00
cmd.arg("2");
2018-05-13 14:56:30 -07:00
let mut child = cmd.spawn_async().unwrap();
2016-09-07 00:13:11 -07:00
let id = child.id();
assert!(id > 0);
2018-05-13 14:56:30 -07:00
let status = tokio_current_thread::block_on_all(&mut child).unwrap();
2016-09-07 00:13:11 -07:00
assert_eq!(status.code(), Some(2));
2018-05-13 14:56:30 -07:00
2016-09-07 00:13:11 -07:00
assert_eq!(child.id(), id);
2016-09-07 12:59:46 -07:00
drop(child.kill());
2016-09-07 00:13:11 -07:00
}