Skip to content

Commit fba04fd

Browse files
Revert "Note the importance of using sync pipes"
This reverts commit 1e7c156.
1 parent 0c75a0e commit fba04fd

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

library/std/src/sys/windows/process.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -527,25 +527,10 @@ impl Stdio {
527527
},
528528

529529
Stdio::MakePipe => {
530-
// Handles that are passed to a child process must be synchronous
531-
// because they will be read synchronously (see #95759).
532-
// Therefore we prefer to make both ends of a pipe synchronous
533-
// just in case our end of the pipe is passed to another process.
534-
//
535-
// However, we may need to read from both the child's stdout and
536-
// stderr simultaneously when waiting for output. This requires
537-
// async reads so as to avoid blocking either pipe.
538-
//
539-
// The solution used here is to make handles synchronous
540-
// except for our side of the stdout and sterr pipes.
541-
// If our side of those pipes do end up being given to another
542-
// process then we use a "pipe relay" to synchronize access
543-
// (see `Stdio::AsyncPipe` below).
530+
// If stdin then make synchronous
544531
let pipes = if stdio_id == c::STD_INPUT_HANDLE {
545-
// For stdin both sides of the pipe are synchronous.
546532
Pipes::new_synchronous(false, true)?
547533
} else {
548-
// For stdout/stderr our side of the pipe is async and their side is synchronous.
549534
pipe::anon_pipe(true, true)?
550535
};
551536
*pipe = Some(pipes.ours);
@@ -582,9 +567,6 @@ impl Stdio {
582567

583568
impl From<AnonPipe> for Stdio {
584569
fn from(pipe: AnonPipe) -> Stdio {
585-
// Note that it's very important we don't give async handles to child processes.
586-
// Therefore if the pipe is asynchronous we must have a way to turn it synchronous.
587-
// See #95759.
588570
match pipe {
589571
AnonPipe::Sync(handle) => Stdio::Handle(handle),
590572
AnonPipe::Async(handle) => Stdio::AsyncPipe(handle),

0 commit comments

Comments
 (0)