8000 config: fix error reading password from piped input - fixes #1308 · devdevmac/rclone@947e10e · GitHub
[go: up one dir, main page]

Skip to content

Commit 947e10e

Browse files
committed
config: fix error reading password from piped input - fixes rclone#1308
1 parent 6b42421 commit 947e10e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/config/config_read_password.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ import (
1616

1717
// ReadPassword reads a password without echoing it to the terminal.
1818
func ReadPassword() string {
19-
line, err := terminal.ReadPassword(int(os.Stdin.Fd()))
19+
stdin := int(os.Stdin.Fd())
20+
if !terminal.IsTerminal(stdin) {
21+
return ReadLine()
22+
}
23+
line, err := terminal.ReadPassword(stdin)
2024
_, _ = fmt.Fprintln(os.Stderr)
2125
if err != nil {
2226
log.Fatalf("Failed to read password: %v", err)

0 commit comments

Comments
 (0)
0