Skip to content

Commit 89432f4

Browse files
committed
Add optimization for linux: Reopen pipe as fifo
so that we could set `O_NONBLOCK` on it. Signed-off-by: Jiahao XU <[email protected]>
1 parent bb1cb04 commit 89432f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/unix.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ impl Client {
155155
(read_err, write_err) => {
156156
read_err?;
157157
write_err?;
158+
159+
#[cfg(target_os = "linux")]
160+
// Optimization: Try converting it to a fifo by using /dev/fd
161+
if let Ok(Some(jobserver)) =
162+
Self::from_fifo(&format!("/dev/fd/{}", read.as_raw_fd()))
163+
{
164+
return Ok(Some(jobserver));
165+
}
158166
}
159167
}
160168

0 commit comments

Comments
 (0)