1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-29 23:17:32 +02:00

Fixed pushing forever

This commit is contained in:
mjarkk 2018-11-10 17:02:39 +01:00
parent 8742c4c110
commit 80c6e0a8c4
3 changed files with 9 additions and 14 deletions

View File

@ -46,11 +46,10 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s
go func() { go func() {
scanner := bufio.NewScanner(tty) scanner := bufio.NewScanner(tty)
scanner.Split(scanWordsWithNewLines) scanner.Split(scanWordsWithNewLines)
loop:
for scanner.Scan() { for scanner.Scan() {
select { select {
case <-stopAsking: case <-stopAsking:
break loop // just do nothing
default: default:
toOutput := strings.Trim(scanner.Text(), " ") toOutput := strings.Trim(scanner.Text(), " ")
cmdOutput = append(cmdOutput, toOutput) cmdOutput = append(cmdOutput, toOutput)
@ -63,8 +62,12 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s
waitForBufio.Done() waitForBufio.Done()
}() }()
if err = cmd.Wait(); err != nil { err = cmd.Wait()
go func() {
stopAsking <- struct{}{} stopAsking <- struct{}{}
}()
<-stopAsking
if err != nil {
waitForBufio.Wait() waitForBufio.Wait()
return strings.Join(cmdOutput, " "), err return strings.Join(cmdOutput, " "), err
} }

View File

@ -77,8 +77,7 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
} }
for prompt, pattern := range prompts { for prompt, pattern := range prompts {
match, _ := regexp.MatchString(pattern, ttyText) if match, _ := regexp.MatchString(pattern, ttyText); match {
if match {
ttyText = "" ttyText = ""
return ask(prompt) return ask(prompt)
} }

View File

@ -7,7 +7,6 @@
package gui package gui
import ( import (
"log"
"strings" "strings"
"github.com/fatih/color" "github.com/fatih/color"
@ -85,14 +84,8 @@ func (gui *Gui) prepareConfirmationPanel(currentView *gocui.View, title, prompt
} }
func (gui *Gui) onNewPopupPanel() { func (gui *Gui) onNewPopupPanel() {
_, err := gui.g.SetViewOnBottom("commitMessage") _, _ = gui.g.SetViewOnBottom("commitMessage")
if err != nil { _, _ = gui.g.SetViewOnBottom("pushPassUname")
log.Fatal(err)
}
_, err = gui.g.SetViewOnBottom("pushPassUname")
if err != nil {
log.Fatal(err)
}
} }
func (gui *Gui) createConfirmationPanel(g *gocui.Gui, currentView *gocui.View, title, prompt string, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error { func (gui *Gui) createConfirmationPanel(g *gocui.Gui, currentView *gocui.View, title, prompt string, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error {