summaryrefslogtreecommitdiffstats
path: root/pkg/commands/os.go
diff options
context:
space:
mode:
authormjarkk <mkopenga@gmail.com>2018-10-27 15:32:12 +0200
committermjarkk <mkopenga@gmail.com>2018-10-27 15:32:12 +0200
commit6c1c110ce035544a8f1ee75fdfc1534655c31e64 (patch)
tree72173e9c3ffe47fd2b68021b797223c5b25cbec6 /pkg/commands/os.go
parent45c249acca0bb4e390f660a896122040510bebd2 (diff)
Made tests pass
Git constandly exits with error code 1 for some reason it might be because of the wrong username and password but i don't think error 1 is for wrong credentials
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r--pkg/commands/os.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go
index 0530962ed..844f36214 100644
--- a/pkg/commands/os.go
+++ b/pkg/commands/os.go
@@ -67,14 +67,13 @@ func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string)
// The ask argument will be "username" or "password" and expects the user's password or username back
func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) error {
ttyText := ""
- errors := []error{}
err := c.RunCommandWithOutputLive(command, func(word string) string {
ttyText = ttyText + " " + word
// detect username question
detectUname, err := regexp.MatchString(`Username\s*for\s*'.+':`, ttyText)
if err != nil {
- errors = append(errors, err)
+ return "-"
}
if detectUname {
// reset the text and return the user's username
@@ -85,7 +84,7 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
// detect password question
detectPass, err := regexp.MatchString(`Password\s*for\s*'.+':`, ttyText)
if err != nil {
- errors = append(errors, err)
+ return "-"
}
if detectPass {
// reset the text and return the user's username
@@ -97,9 +96,6 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
if err != nil {
return err
}
- if len(errors) > 0 {
- return errors[0]
- }
return nil
}