-
Notifications
You must be signed in to change notification settings - Fork 816
Open
Description
Here is a reproducer:
use mio::windows::NamedPipe;
use mio::{Events, Interest, Poll, Token};
use std::env;
use std::os::windows::io::{FromRawHandle, IntoRawHandle};
use std::process::{Command, Stdio};
fn main() {
if env::var("FOO").is_ok() {
println!("Hello, world!");
} else {
let mut proc = Command::new(std::env::current_exe().unwrap())
.env("FOO", "1")
.stdout(Stdio::piped())
.spawn()
.unwrap();
let mut out =
unsafe { NamedPipe::from_raw_handle(proc.stdout.take().unwrap().into_raw_handle()) };
let mut events = Events::with_capacity(16);
let mut poll = Poll::new().unwrap();
poll.registry()
.register(&mut out, Token(0), Interest::READABLE)
.unwrap();
poll.poll(&mut events, None).unwrap();
dbg!(events);
proc.wait().unwrap();
}
}
The dbg prints:
[src/main.rs:24:9] events = [
Event {
token: Token(
0,
),
readable: false,
writable: true,
error: false,
read_closed: false,
write_closed: fakse,
priority: false
aio: false,
lio: false,
details: event {
flags: POLL_SEND,
data: 0,
},
},
]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels