From 2e28b88e3a0c2ab684134b7388ad89a3442b3f57 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 2 Jan 2015 22:33:16 +0100 Subject: [PATCH] Write prompt to stderr instead of stdout --- cmd/restic/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/restic/main.go b/cmd/restic/main.go index f5c39f5e3..b413dcb41 100644 --- a/cmd/restic/main.go +++ b/cmd/restic/main.go @@ -40,12 +40,12 @@ func readPassword(env string, prompt string) string { } } - fmt.Print(prompt) + fmt.Fprint(os.Stderr, prompt) pw, err := terminal.ReadPassword(int(os.Stdin.Fd())) if err != nil { errx(2, "unable to read password: %v", err) } - fmt.Println() + fmt.Fprintln(os.Stderr) return string(pw) }