Skip to content

Commit

Permalink
chore: stdin support windows
Browse files Browse the repository at this point in the history
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
  • Loading branch information
lingsamuel committed Nov 10, 2023
1 parent 84e9203 commit 7c8f976
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ import (
"crypto/x509"
"errors"
"fmt"
"net/url"
"os"
"path/filepath"
"strings"
"syscall"

"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/term"
"net/url"
"os"
"path/filepath"
"strings"
)

// newConfigureCmd represents the configure command
Expand Down Expand Up @@ -177,8 +175,8 @@ func saveConfiguration(cmd *cobra.Command) error {

if rootConfig.Token == "" || overwrite {
fmt.Println("Please enter the APISIX token: ")
if term.IsTerminal(syscall.Stdin) {
token, err := term.ReadPassword(syscall.Stdin)
if term.IsTerminal(int(os.Stdin.Fd())) {
token, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return err
}
Expand Down

0 comments on commit 7c8f976

Please sign in to comment.