fix: Portability of stdin
This commit is contained in:
parent
4a85116b4a
commit
e4ee5a4526
1 changed files with 3 additions and 2 deletions
5
main.go
5
main.go
|
@ -4,10 +4,11 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The XML response returned by the WatchGuard server
|
// The XML response returned by the WatchGuard server
|
||||||
|
@ -60,7 +61,7 @@ func readCredentials() (string, string, error) {
|
||||||
username, err := reader.ReadString('\n')
|
username, err := reader.ReadString('\n')
|
||||||
|
|
||||||
fmt.Printf("Password: ")
|
fmt.Printf("Password: ")
|
||||||
password, err := terminal.ReadPassword(1)
|
password, err := terminal.ReadPassword(syscall.Stdin)
|
||||||
|
|
||||||
// If an error occured, I don't care about which one it is.
|
// If an error occured, I don't care about which one it is.
|
||||||
return strings.TrimSpace(username), strings.TrimSpace(string(password)), err
|
return strings.TrimSpace(username), strings.TrimSpace(string(password)), err
|
||||||
|
|
Loading…
Add table
Reference in a new issue