it does not work actually
cargo devel CI / cargo CI (push) Failing after 22s
Details
cargo devel CI / cargo CI (push) Failing after 22s
Details
This commit is contained in:
parent
f0765004b7
commit
bec7203240
11
src/main.rs
11
src/main.rs
|
@ -1,12 +1,15 @@
|
|||
use std::io::{self, prelude::*};
|
||||
|
||||
fn main() -> Result<(), io::Error> {
|
||||
// TODO: check if stdin is empty and show usage
|
||||
let mut tty = std::fs::File::options()
|
||||
.write(true)
|
||||
.read(false)
|
||||
.open("/dev/tty")?;
|
||||
io::copy(&mut io::stdin(), &mut tty)?;
|
||||
tty.flush()?;
|
||||
io::copy(&mut io::stdin(), &mut io::stdout())?;
|
||||
.open("/dev/tty")
|
||||
.inspect_err(|err| eprintln!("{err}"))?;
|
||||
// FIXME: only works with cargo run?
|
||||
io::copy(&mut io::stdin(), &mut tty).inspect_err(|err| eprintln!("{err}"))?;
|
||||
tty.flush().inspect_err(|err| eprintln!("{err}"))?;
|
||||
io::copy(&mut io::stdin(), &mut io::stdout()).inspect_err(|err| eprintln!("{err}"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#[test]
|
||||
fn pipe_echo_cat() {
|
||||
todo!()
|
||||
}
|
Loading…
Reference in New Issue