mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-08 23:56:15 +02:00
explicitly return newlines to our live command stdin
This commit is contained in:
parent
865c7c2332
commit
20a94447d7
@ -41,10 +41,7 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s
|
|||||||
scanner.Split(scanWordsWithNewLines)
|
scanner.Split(scanWordsWithNewLines)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
toOutput := strings.Trim(scanner.Text(), " ")
|
toOutput := strings.Trim(scanner.Text(), " ")
|
||||||
toWrite := output(toOutput)
|
_, _ = ptmx.WriteString(output(toOutput))
|
||||||
if len(toWrite) > 0 {
|
|
||||||
_, _ = ptmx.WriteString(toWrite + "\n")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCrede
|
|||||||
if canAskForCredentials {
|
if canAskForCredentials {
|
||||||
return unamePassQuestion(question)
|
return unamePassQuestion(question)
|
||||||
}
|
}
|
||||||
return "-"
|
return "\n"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ func TestGitCommandPush(t *testing.T) {
|
|||||||
gitCmd := newDummyGitCommand()
|
gitCmd := newDummyGitCommand()
|
||||||
gitCmd.OSCommand.command = s.command
|
gitCmd.OSCommand.command = s.command
|
||||||
err := gitCmd.Push("test", s.forcePush, func(passOrUname string) string {
|
err := gitCmd.Push("test", s.forcePush, func(passOrUname string) string {
|
||||||
return "-"
|
return "\n"
|
||||||
})
|
})
|
||||||
s.test(err)
|
s.test(err)
|
||||||
})
|
})
|
||||||
|
@ -30,15 +30,11 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn
|
|||||||
|
|
||||||
// wait for username/passwords input
|
// wait for username/passwords input
|
||||||
userInput := <-gui.credentials
|
userInput := <-gui.credentials
|
||||||
return userInput
|
return userInput + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error {
|
||||||
message := gui.trimmedContent(v)
|
message := gui.trimmedContent(v)
|
||||||
if message == "" {
|
|
||||||
// sending an obviously incorrect password so that the program isn't stuck waiting
|
|
||||||
message = "-"
|
|
||||||
}
|
|
||||||
gui.credentials <- message
|
gui.credentials <- message
|
||||||
err := gui.refreshFiles(g)
|
err := gui.refreshFiles(g)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -70,7 +66,7 @@ func (gui *Gui) handleCloseCredentialsView(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.credentials <- "-"
|
gui.credentials <- ""
|
||||||
return gui.switchFocus(g, nil, gui.getFilesView(g))
|
return gui.switchFocus(g, nil, gui.getFilesView(g))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user