fixme
This commit is contained in:
parent
f6f91e5201
commit
5182cb446d
|
@ -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}"))?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue