File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,12 @@ package cmd
99import (
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
2220const DEFAULT_CONFIG_FILE_NAME = "command_config.json"
@@ -176,7 +174,7 @@ func init() {
176174
177175func 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 )
You can’t perform that action at this time.
0 commit comments