Files
tokio/tokio-process/tests/smoke.rs
T

24 lines
457 B
Rust
Raw Normal View History

#![warn(rust_2018_idioms)]
2019-08-07 10:38:45 -07:00
#![feature(async_await)]
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
2019-08-07 10:38:45 -07:00
#[tokio::test]
async 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().unwrap();
2018-05-13 14:56:30 -07:00
2016-09-07 00:13:11 -07:00
let id = child.id();
assert!(id > 0);
2018-05-13 14:56:30 -07:00
2019-08-07 10:38:45 -07:00
let status = support::with_timeout(&mut child)
.await
.expect("failed to run future");
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
}