Skip to content

Commit 1bab95b

Browse files
committed
std::process (windows): Implement From<io::Stdout> etc. for imp::Stdio
This involves a new variant `imp;::Stdio::InheritSpecific`. Signed-off-by: Ian Jackson <[email protected]>
1 parent deda7d3 commit 1bab95b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pub struct Command {
170170

171171
pub enum Stdio {
172172
Inherit,
173+
InheritSpecific { from_stdio_id: c::DWORD },
173174
Null,
174175
MakePipe,
175176
Pipe(AnonPipe),
@@ -533,6 +534,7 @@ impl Stdio {
533534
};
534535
match *self {
535536
Stdio::Inherit => use_stdio_id(stdio_id),
537+
Stdio::InheritSpecific { from_stdio_id } => use_stdio_id(from_stdio_id),
536538

537539
Stdio::MakePipe => {
538540
let ours_readable = stdio_id != c::STD_INPUT_HANDLE;
@@ -580,6 +582,18 @@ impl From<File> for Stdio {
580582
}
581583
}
582584

585+
impl From<io::Stdout> for Stdio {
586+
fn from(_: io::Stdout) -> Stdio {
587+
Stdio::InheritSpecific { from_stdio_id: c::STD_OUTPUT_HANDLE }
588+
}
589+
}
590+
591+
impl From<io::Stderr> for Stdio {
592+
fn from(_: io::Stderr) -> Stdio {
593+
Stdio::InheritSpecific { from_stdio_id: c::STD_ERROR_HANDLE }
594+
}
595+
}
596+
583597
////////////////////////////////////////////////////////////////////////////////
584598
// Processes
585599
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)