From 916311064059aafd13f44f7e2145b87f7e529cba Mon Sep 17 00:00:00 2001 From: mjarkk Date: Sat, 27 Oct 2018 15:52:12 +0200 Subject: [PATCH] Removed error check for regex Regexp only returns an error when regex string is in-corret --- pkg/commands/os.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 844f36214..88e4f52cd 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -71,10 +71,7 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err ttyText = ttyText + " " + word // detect username question - detectUname, err := regexp.MatchString(`Username\s*for\s*'.+':`, ttyText) - if err != nil { - return "-" - } + detectUname, _ := regexp.MatchString(`Username\s*for\s*'.+':`, ttyText) if detectUname { // reset the text and return the user's username ttyText = "" @@ -82,10 +79,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 { - return "-" - } + detectPass, _ := regexp.MatchString(`Password\s*for\s*'.+':`, ttyText) if detectPass { // reset the text and return the user's username ttyText = ""