Skip to content

Commit dd44e09

Browse files
committed
Fix test hangs on macos.
In the `waitpid` tests, ensure that the child process has exited, as dropping `Command` otherwise leaves the process running. This fixes test hangs on macos.
1 parent fff5c2a commit dd44e09

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/process/wait.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ fn test_waitpid_none() {
2323
.unwrap();
2424
assert_eq!(pid, process::Pid::from_child(&child));
2525
assert!(status.stopped());
26+
27+
// Clean up the child process.
28+
unsafe { kill(child.id() as _, SIGKILL) };
2629
}
2730

2831
#[test]
@@ -41,6 +44,9 @@ fn test_waitpid_some() {
4144
.unwrap();
4245
assert_eq!(rpid, pid);
4346
assert!(status.stopped());
47+
48+
// Clean up the child process.
49+
unsafe { kill(child.id() as _, SIGKILL) };
4450
}
4551

4652
#[test]
@@ -59,6 +65,9 @@ fn test_waitpgid() {
5965
.unwrap();
6066
assert_eq!(pid, process::Pid::from_child(&child));
6167
assert!(status.stopped());
68+
69+
// Clean up the child process.
70+
unsafe { kill(child.id() as _, SIGKILL) };
6271
}
6372

6473
#[cfg(not(any(

0 commit comments

Comments
 (0)