From 20a94447d7bad91848ae75b391eaf6feb92e10c4 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 18 Dec 2018 22:23:17 +1100 Subject: explicitly return newlines to our live command stdin --- pkg/commands/exec_live_default.go | 5 +---- pkg/commands/git.go | 2 +- pkg/commands/git_test.go | 2 +- pkg/gui/credentials_panel.go | 8 ++------ 4 files changed, 5 insertions(+), 12 deletions(-) (limited to 'pkg') diff --git a/pkg/commands/exec_live_default.go b/pkg/commands/exec_live_default.go index bce912160..a61b5f398 100644 --- a/pkg/commands/exec_live_default.go +++ b/pkg/commands/exec_live_default.go @@ -41,10 +41,7 @@ func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(s scanner.Split(scanWordsWithNewLines) for scanner.Scan() { toOutput := strings.Trim(scanner.Text(), " ") - toWrite := output(toOutput) - if len(toWrite) > 0 { - _, _ = ptmx.WriteString(toWrite + "\n") - } + _, _ = ptmx.WriteString(output(toOutput)) } }() diff --git a/pkg/commands/git.go b/pkg/commands/git.go index e708d5c55..a1f01e422 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -266,7 +266,7 @@ func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCrede if canAskForCredentials { return unamePassQuestion(question) } - return "-" + return "\n" }) } diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 2413976fc..2302391ec 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1045,7 +1045,7 @@ func TestGitCommandPush(t *testing.T) { gitCmd := newDummyGitCommand() gitCmd.OSCommand.command = s.command err := gitCmd.Push("test", s.forcePush, func(passOrUname string) string { - return "-" + return "\n" }) s.test(err) }) diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index 6c8f8b4ef..dd5461441 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -30,15 +30,11 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn // wait for username/passwords input userInput := <-gui.credentials - return userInput + return userInput + "\n" } func (gui *Gui) handleSubmitCredential(g *gocui.Gui, v *gocui.View) error { message := gui.trimmedContent(v) - if message == "" { - // sending an obviously incorrect password so that the program isn't stuck waiting - message = "-" - } gui.credentials <- message err := gui.refreshFiles(g) if err != nil { @@ -70,7 +66,7 @@ func (gui *Gui) handleCloseCredentialsView(g *gocui.Gui, v *gocui.View) error { return err } - gui.credentials <- "-" + gui.credentials <- "" return gui.switchFocus(g, nil, gui.getFilesView(g)) } -- cgit v1.2.3