fixme
This commit is contained in:
parent
f6f91e5201
commit
5182cb446d
|
@ -9,13 +9,15 @@ fn main() -> Result<(), io::Error> {
|
||||||
.read(false)
|
.read(false)
|
||||||
// try to use $TTY set by the terminal, otherwise use the default tty
|
// try to use $TTY set by the terminal, otherwise use the default tty
|
||||||
.open(std::env::var("TTY").unwrap_or(String::from(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
|
// we want to write to the stdout too
|
||||||
let mut stdout = io::stdout();
|
let mut stdout = io::stdout();
|
||||||
// sadly, we need to store the content of `stdin` in a buffer and cannot just `io::copy()` it
|
// 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.
|
// multiple times. `tee` from the GNU coreutils does this too.
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
io::stdin()
|
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)
|
.read_to_end(&mut buf)
|
||||||
.inspect_err(|err| eprintln!("{err}"))?;
|
.inspect_err(|err| eprintln!("{err}"))?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue