Function mkfifo

Source
pub fn mkfifo<P: AsRef<Path>>(path: P, permissions: Permissions) -> Result<()>
🔬This is a nightly-only experimental API. (unix_mkfifo #139324)
Available on Unix only.
Expand description

Create a FIFO special file at the specified path with the specified mode.

§Examples

mkfifo("/tmp/fifo", Permissions::from_mode(0o774))?;

let mut wx = File::options().read(true).write(true).open("/tmp/fifo")?;
let mut rx = File::open("/tmp/fifo")?;

wx.write_all(b"hello, world!")?;
drop(wx);

let mut s = String::new();
rx.read_to_string(&mut s)?;

assert_eq!(s, "hello, world!");