[go: up one dir, main page]

make_fifo

Function make_fifo 

Source
pub fn make_fifo(path: &Path) -> Result<()>
Expand description

Make a FIFO, also known as a named pipe.

This is a safe wrapper for the unsafe libc::mkfifo function, which makes a named pipe on Unix systems.

§Errors

If the named pipe cannot be created.

§Examples

use uucore::fs::make_fifo;

make_fifo("my-pipe").expect("failed to create the named pipe");

std::thread::spawn(|| { std::fs::write("my-pipe", b"hello").unwrap(); });
assert_eq!(std::fs::read("my-pipe").unwrap(), b"hello");