Skip to content

API allows passing a vector for the buffer, but it doesn't work properly. #2

Description

@vext01

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions