Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(process): Use pidfd on Linux for tokio::process::Child::wait #6152

Merged
merged 17 commits into from
Jan 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add process_spawned_and_wait_in_different_runtime
Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu committed Jan 9, 2024
commit 66a2f4e5ed4eee10ba13be443fbf34b080255a6d
27 changes: 27 additions & 0 deletions tokio/tests/process_spawned_and_wait_in_different_runtime.rs
NobodyXu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `EV_ERROR` flag set. If either flag is set a write would be
// attempted, but that does not seem to occur.
#![cfg(all(unix, not(target_os = "freebsd")))]

use std::process::Stdio;
use tokio::{process::Command, runtime::Runtime};

#[test]
fn process_spawned_and_wait_in_different_runtime() {
let mut child = Runtime::new().unwrap().block_on(async {
Command::new("true")
.stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn()
.unwrap()
});
Runtime::new().unwrap().block_on(async {
let _ = child.wait().await.unwrap();
});
}
Loading