From f53096dc5b42eff95c3e9d86f5cdfddb7a392e58 Mon Sep 17 00:00:00 2001 From: shimun Date: Fri, 16 Jul 2021 15:11:31 +0200 Subject: [PATCH] password helper: inherit stdin, stderr should make fido2luks much easier to use in boot scripts since it will allow for usage as follows: `fido2luks open-token /dev/disk/by-uuid/sda1 test 'bash -c "read -p Pass PW 1>&2; echo $PW"'` which will read the password from the current terminal --- src/cli_args/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli_args/config.rs b/src/cli_args/config.rs index cde093f..ed99975 100644 --- a/src/cli_args/config.rs +++ b/src/cli_args/config.rs @@ -7,6 +7,7 @@ use std::fs::File; use std::io::Read; use std::path::PathBuf; use std::process::Command; +use std::process::Stdio; use std::str::FromStr; #[derive(Debug, Clone, PartialEq)] @@ -156,6 +157,8 @@ impl PasswordHelper { let password = Command::new("sh") .arg("-c") .arg(&password_helper) + .stdin(Stdio::inherit()) + .stderr(Stdio::inherit()) .output() .map_err(|e| Fido2LuksError::AskPassError { cause: error::AskPassError::IO(e),