1
Fork 0

Windows: Use a pipe relay for chaining pipes

This commit is contained in:
Chris Denton 2022-04-08 11:35:29 +01:00
parent e745b4ddbd
commit 90130549f4
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
2 changed files with 50 additions and 1 deletions

View file

@ -172,6 +172,7 @@ pub enum Stdio {
Inherit,
Null,
MakePipe,
Pipe(AnonPipe),
Handle(Handle),
}
@ -528,6 +529,11 @@ impl Stdio {
Ok(pipes.theirs.into_handle())
}
Stdio::Pipe(ref source) => {
let ours_readable = stdio_id != c::STD_INPUT_HANDLE;
pipe::spawn_pipe_relay(source, ours_readable, true).map(AnonPipe::into_handle)
}
Stdio::Handle(ref handle) => handle.duplicate(0, true, c::DUPLICATE_SAME_ACCESS),
// Open up a reference to NUL with appropriate read/write
@ -552,7 +558,7 @@ impl Stdio {
impl From<AnonPipe> for Stdio {
fn from(pipe: AnonPipe) -> Stdio {
Stdio::Handle(pipe.into_handle())
Stdio::Pipe(pipe)
}
}