Skip to content

Commit e9b74de

Browse files
committed
fix(cli): Removed syscall refs because they're not supported by Windows.
1 parent 1937fa6 commit e9b74de

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cmd/login.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ package cmd
99
import (
1010
"encoding/json"
1111
"fmt"
12+
"github.com/spf13/cobra"
1213
"golang.org/x/crypto/ssh/terminal"
1314
"log"
1415
"os"
1516
"os/signal"
1617
"strings"
17-
"syscall"
18-
19-
"github.com/spf13/cobra"
2018
)
2119

2220
const DEFAULT_CONFIG_FILE_NAME = "command_config.json"
@@ -176,7 +174,7 @@ func init() {
176174

177175
func getPassword(prompt string) string {
178176
// Get the initial state of the terminal.
179-
initialTermState, e1 := terminal.GetState(syscall.Stdin)
177+
initialTermState, e1 := terminal.GetState(int(os.Stdin.Fd()))
180178
if e1 != nil {
181179
panic(e1)
182180
}
@@ -185,13 +183,13 @@ func getPassword(prompt string) string {
185183
signal.Notify(c, os.Interrupt, os.Kill)
186184
go func() {
187185
<-c
188-
_ = terminal.Restore(syscall.Stdin, initialTermState)
186+
_ = terminal.Restore(int(os.Stdin.Fd()), initialTermState)
189187
os.Exit(1)
190188
}()
191189

192190
// Now get the password.
193191
fmt.Print(prompt)
194-
p, err := terminal.ReadPassword(syscall.Stdin)
192+
p, err := terminal.ReadPassword(int(os.Stdin.Fd()))
195193
fmt.Println("")
196194
if err != nil {
197195
panic(err)

0 commit comments

Comments
 (0)