ensure stdout stays open
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
shimunn 2019-09-22 17:54:48 +02:00
parent 4a3b6f8e23
commit de76f3f480
Signed by: shimun
GPG Key ID: E81D8382DC2F971B

View File

@ -154,6 +154,7 @@ pub fn parse_cmdline() -> Args {
} }
pub fn run_cli() -> Fido2LuksResult<()> { pub fn run_cli() -> Fido2LuksResult<()> {
let mut stdout = io::stdout();
let args = parse_cmdline(); let args = parse_cmdline();
match &args.command { match &args.command {
Command::Credential => { Command::Credential => {
@ -167,11 +168,11 @@ pub fn run_cli() -> Fido2LuksResult<()> {
} => { } => {
let secret = secret_gen.patch(&args).obtain_secret()?; let secret = secret_gen.patch(&args).obtain_secret()?;
if *binary { if *binary {
io::stdout().write(&secret[..])?; stdout.write(&secret[..])?;
} else { } else {
io::stdout().write(hex::encode(&secret[..]).as_bytes())?; stdout.write(hex::encode(&secret[..]).as_bytes())?;
} }
Ok(io::stdout().flush()?) Ok(stdout.flush()?)
} }
Command::AddKey { Command::AddKey {
device, device,