mirror of
https://github.com/rclone/rclone.git
synced 2025-01-19 04:42:56 +08:00
config: fix error reading password from piped input - fixes #1308
This commit is contained in:
parent
6b42421374
commit
947e10eb2b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user