diff --git a/go.mod b/go.mod index 9cca9267..878f6192 100644 --- a/go.mod +++ b/go.mod @@ -48,3 +48,5 @@ require ( gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 gopkg.in/yaml.v2 v2.2.2 // indirect ) + +replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.30 //indirect diff --git a/jiracli/cli.go b/jiracli/cli.go index d834520a..f0e03001 100644 --- a/jiracli/cli.go +++ b/jiracli/cli.go @@ -166,6 +166,7 @@ func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) { app.Flag("socksproxy", "Address for a socks proxy").SetValue(&globals.SocksProxy) app.Flag("user", "user name used within the Jira service").Short('u').SetValue(&globals.User) app.Flag("login", "login name that corresponds to the user used for authentication").SetValue(&globals.Login) + app.Flag("passwordsource", "Method to fetch the password").SetValue(&globals.PasswordSource) o = o.WithPreCallback(func(req *http.Request) (*http.Request, error) { if globals.AuthMethod() == "api-token" { diff --git a/jiracli/password.go b/jiracli/password.go index 1baa986f..032363c9 100644 --- a/jiracli/password.go +++ b/jiracli/password.go @@ -3,7 +3,6 @@ package jiracli import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -118,11 +117,12 @@ func (o *GlobalOptions) GetPass() string { } } else if o.PasswordSource.Value == "stdin" { log.Info("Reading password from stdin.") - allBytes, err := ioutil.ReadAll(os.Stdin) + var buffer [512]byte + nBytes, err := os.Stdin.Read(buffer[:]) if err != nil { panic(fmt.Sprintf("unable to read bytes from stdin: %s", err)) } - o.cachedPassword = string(allBytes) + o.cachedPassword = string(buffer[:nBytes-1]) } else { log.Warningf("Unknown password-source: %s", o.PasswordSource) }