From fd91788b48c706e7c12d73f9f0ca70256d8538d4 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Wed, 16 Aug 2023 22:58:04 -0700 Subject: [PATCH] Add cat demonstration program Signed-off-by: Leni Aniva --- examples/cat.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/cat.rs diff --git a/examples/cat.rs b/examples/cat.rs new file mode 100644 index 00000000..0accb03e --- /dev/null +++ b/examples/cat.rs @@ -0,0 +1,14 @@ +use rexpect::error::Error; +use rexpect::spawn; + +fn main() -> Result<(), Error> { + let mut p = spawn("cat", Some(1000))?; + + let ex: String = "∀".to_string(); + p.send_line(&ex)?; + let line = p.read_line()?; + + println!("In: {}", &ex); + println!("Out: {}", &line); + Ok(()) +}