From 947e10eb2bb324f19cf28055760644c2b216218f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 28 Jun 2018 11:54:15 +0100 Subject: [PATCH] config: fix error reading password from piped input - fixes #1308 --- fs/config/config_read_password.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/config/config_read_password.go b/fs/config/config_read_password.go index 26f4d11ac..9baf3793a 100644 --- a/fs/config/config_read_password.go +++ b/fs/config/config_read_password.go @@ -16,7 +16,11 @@ import ( // ReadPassword reads a password without echoing it to the terminal. func ReadPassword() string { - line, err := terminal.ReadPassword(int(os.Stdin.Fd())) + stdin := int(os.Stdin.Fd()) + if !terminal.IsTerminal(stdin) { + return ReadLine() + } + line, err := terminal.ReadPassword(stdin) _, _ = fmt.Fprintln(os.Stderr) if err != nil { log.Fatalf("Failed to read password: %v", err)