write_repeat/
write_repeat.rs1use async_std::{io, task};
2use unix_fifo_async::NamedPipePath;
3
4fn main() -> io::Result<()> {
14 let text = std::env::args()
15 .nth(1)
16 .unwrap_or_else(|| "Hello world!".to_string())
17 + "\n";
18 println!("Writing String: {}", &text);
19 task::block_on(async move {
20 let pipe = NamedPipePath::new("./my_pipe");
21 let writer = pipe.open_write();
22 loop {
23 writer.ensure_pipe_exists().unwrap();
24 println!("Waiting for receiver...");
25 writer.write_str(&text).await?;
26 }
27 })
28}