Function mkfifo
fn mkfifo<P: AsRef<crate::path::Path>>(path: P, permissions: crate::fs::Permissions) -> io::Result<()>
Create a FIFO special file at the specified path with the specified mode.
Examples
# #![feature(unix_mkfifo)]
# #[cfg(not(unix))]
# fn main() {}
# #[cfg(unix)]
# fn main() -> std::io::Result<()> {
# use std::{
# os::unix::fs::{mkfifo, PermissionsExt},
# fs::{File, Permissions, remove_file},
# io::{Write, Read},
# };
# let _ = remove_file("/tmp/fifo");
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!");
# Ok(())
# }