Skip to content

Commit

Permalink
Fixing sca
Browse files Browse the repository at this point in the history
  • Loading branch information
breathbath committed Feb 18, 2021
1 parent 3a28519 commit 46e77bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/pkg/config/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import (
"fmt"
"os"
"strings"
"syscall"

"golang.org/x/term"

"github.com/cloudradar-monitoring/rportcli/internal/pkg/cli"
"github.com/cloudradar-monitoring/rportcli/internal/pkg/utils"

"github.com/fatih/color"
)
Expand All @@ -29,7 +27,7 @@ func (dr *DefaultReader) ReadString(delim byte) (string, error) {
}

func (dr *DefaultReader) ReadPassword() (string, error) {
inputBytes, err := term.ReadPassword(int(syscall.Stdin))
inputBytes, err := utils.ReadPassword()
return string(inputBytes), err
}

Expand Down
13 changes: 13 additions & 0 deletions internal/pkg/utils/io_nix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris

package utils

import (
"syscall"

"golang.org/x/term"
)

func ReadPassword() ([]byte, error) {
return term.ReadPassword(syscall.Stdin)
}
13 changes: 13 additions & 0 deletions internal/pkg/utils/io_win.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build windows

package utils

import (
"syscall"

"golang.org/x/term"
)

func ReadPassword() ([]byte, error) {
return term.ReadPassword(int(syscall.Stdin))
}

0 comments on commit 46e77bf

Please sign in to comment.