From 5182cb446dc96829c94ebbc2a67b2ecfef88bcc2 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 21 Feb 2024 14:15:46 +0100 Subject: [PATCH] fixme --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 80abace..a2fab2b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,13 +9,15 @@ fn main() -> Result<(), io::Error> { .read(false) // try to use $TTY set by the terminal, otherwise use the default tty .open(std::env::var("TTY").unwrap_or(String::from(TTY))) - .inspect_err(|err| eprintln!("{err}"))?; + .inspect_err(|err| eprintln!("could not open tty: {err}"))?; // we want to write to the stdout too let mut stdout = io::stdout(); // sadly, we need to store the content of `stdin` in a buffer and cannot just `io::copy()` it // multiple times. `tee` from the GNU coreutils does this too. let mut buf = Vec::new(); io::stdin() + // FIXME: we don't want to always read to end! If we want to seep a network socket for + // example. .read_to_end(&mut buf) .inspect_err(|err| eprintln!("{err}"))?;