The example, with one small adjustment: the buffer is a Vec:
fn main() -> io::Result<()> {
let mut cli = AskPass::new(Vec::new());
let pass = cli.askpass("Password:")?;
let mut stdout = io::stdout();
write!(&mut stdout, "Your password is ")?;
stdout.write_all(pass)?;
stdout.flush()?;
Ok(())
}
This compiles and runs, but askpass() returns an empty password:
$ cargo run
Compiling tty v0.1.0 (/tmp/tty)
Finished dev [unoptimized + debuginfo] target(s) in 0.66s
Running `target/debug/tty`
Your password is
$
Is that intentional?
The example, with one small adjustment: the buffer is a
Vec:This compiles and runs, but
askpass()returns an empty password:Is that intentional?