From 13c28408f955f74785e0a37d97a932ee66055a6d Mon Sep 17 00:00:00 2001 From: Marcel Transier Date: Fri, 11 Oct 2019 16:12:26 +0200 Subject: [PATCH] Write username and password prompt to stderr --- README.md | 1 - cmd/lsf/main.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f39e075..2b1653d 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,3 @@ or LSF Served Fabulously - tests - webapi - wrap errors correctly. run cmd/lsf without an internet connection and get inspired by the standard libary -- username/password prompt stderr diff --git a/cmd/lsf/main.go b/cmd/lsf/main.go index f7432a4..6e4c347 100644 --- a/cmd/lsf/main.go +++ b/cmd/lsf/main.go @@ -74,7 +74,7 @@ func sessionNeeded() { func readUsername() (string, error) { var username string - fmt.Print("Username: ") + fmt.Fprint(os.Stderr, "Username: ") _, err := fmt.Scanf("%s", &username) if err != nil { return "", errors.Wrap(err, "could not read username") @@ -84,12 +84,12 @@ func readUsername() (string, error) { func readPassword() (string, error) { var password string - fmt.Print("Password: ") + fmt.Fprint(os.Stderr, "Password: ") b, err := terminal.ReadPassword(int(syscall.Stdin)) if err != nil { return "", err } - fmt.Print("\n") + fmt.Fprint(os.Stderr, "\n") password = string(b) return password, nil }