Function mkfifo

Source
pub fn mkfifo<P>(path: P, permissions: Permissions) -> Result<(), Error>
where P: AsRef<Path>,
🔬This is a nightly-only experimental API. (unix_mkfifo)
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!");