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::*};
|
use std::io::{self, prelude::*};
|
||||||
|
|
||||||
fn main() -> Result<(), io::Error> {
|
fn main() -> Result<(), io::Error> {
|
||||||
|
// TODO: check if stdin is empty and show usage
|
||||||
let mut tty = std::fs::File::options()
|
let mut tty = std::fs::File::options()
|
||||||
.write(true)
|
.write(true)
|
||||||
.read(false)
|
.read(false)
|
||||||
.open("/dev/tty")?;
|
.open("/dev/tty")
|
||||||
io::copy(&mut io::stdin(), &mut tty)?;
|
.inspect_err(|err| eprintln!("{err}"))?;
|
||||||
tty.flush()?;
|
// FIXME: only works with cargo run?
|
||||||
io::copy(&mut io::stdin(), &mut io::stdout())?;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#[test]
|
||||||
|
fn pipe_echo_cat() {
|
||||||
|
todo!()
|
||||||
|
}
|
Loading…
Reference in New Issue