Skip to content

Commit d9f0980

Browse files
committed
Fix anonymous_pipe impl for not supported targets
Signed-off-by: Jiahao XU <[email protected]>
1 parent 594abec commit d9f0980

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

library/std/src/sys/anonymous_pipe/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> {
77
cfg_if::cfg_if! {
88
if #[cfg(unix)] {
99
unix::pipe()
10-
} else {
10+
} else if #[cfg(windows)] {
1111
windows::pipe()
12+
} else {
13+
panic!("Anonymous pipe is not supported on this target!")
1214
}
1315
}
1416
}

library/std/src/sys/pal/unsupported/pipe.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
33
pub struct AnonPipe(!);
44

55
impl AnonPipe {
6+
pub fn try_clone(&self) -> io::Result<Self> {
7+
self.0
8+
}
9+
610
pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
711
self.0
812
}

0 commit comments

Comments
 (0)