mirror of
https://github.com/openharmony/third_party_rust_rustix.git
synced 2026-07-01 20:54:01 -04:00
5d9c62cc10
修复措施:升级rustix版本到0.38.16版本 Signed-off-by: ljy9810 <longjianyin@h-partners.com>
25 lines
729 B
Rust
25 lines
729 B
Rust
use libc::{kill, SIGSTOP};
|
|
use rustix::process;
|
|
use std::process::{Command, Stdio};
|
|
|
|
// These tests must execute serially to prevent race condition, where
|
|
// `test_wait` waits for the child process spawned in `test_waitpid`, causing
|
|
// the tests to get stuck.
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn test_waitpid() {
|
|
let child = Command::new("yes")
|
|
.stdout(Stdio::null())
|
|
.stderr(Stdio::null())
|
|
.spawn()
|
|
.expect("failed to execute child");
|
|
unsafe { kill(child.id() as _, SIGSTOP) };
|
|
|
|
let pid = unsafe { process::Pid::from_raw(child.id() as _) };
|
|
let status = process::waitpid(pid, process::WaitOptions::UNTRACED)
|
|
.expect("failed to wait")
|
|
.unwrap();
|
|
assert!(status.stopped());
|
|
}
|