mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Fixed pushing forever
This commit is contained in:
@ -46,11 +46,10 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s
|
||||
go func() {
|
||||
scanner := bufio.NewScanner(tty)
|
||||
scanner.Split(scanWordsWithNewLines)
|
||||
loop:
|
||||
for scanner.Scan() {
|
||||
select {
|
||||
case <-stopAsking:
|
||||
break loop
|
||||
// just do nothing
|
||||
default:
|
||||
toOutput := strings.Trim(scanner.Text(), " ")
|
||||
cmdOutput = append(cmdOutput, toOutput)
|
||||
@ -63,8 +62,12 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s
|
||||
waitForBufio.Done()
|
||||
}()
|
||||
|
||||
if err = cmd.Wait(); err != nil {
|
||||
err = cmd.Wait()
|
||||
go func() {
|
||||
stopAsking <- struct{}{}
|
||||
}()
|
||||
<-stopAsking
|
||||
if err != nil {
|
||||
waitForBufio.Wait()
|
||||
return strings.Join(cmdOutput, " "), err
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
|
||||
}
|
||||
|
||||
for prompt, pattern := range prompts {
|
||||
match, _ := regexp.MatchString(pattern, ttyText)
|
||||
if match {
|
||||
if match, _ := regexp.MatchString(pattern, ttyText); match {
|
||||
ttyText = ""
|
||||
return ask(prompt)
|
||||
}
|
||||
|
Reference in New Issue
Block a user