Skip to content

Commit 52d3446

Browse files
committed
Pass cmdObj instead of task to processOutput
This is a preparation for the next commit, where we will need more from the cmdObj in processOutput.
1 parent da32b59 commit 52d3446

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/commands/oscommands/cmd_obj_runner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"time"
1111

1212
"github.com/go-errors/errors"
13-
"github.com/jesseduffield/gocui"
1413
"github.com/jesseduffield/lazygit/pkg/utils"
1514
"github.com/sasha-s/go-deadlock"
1615
"github.com/sirupsen/logrus"
@@ -340,7 +339,7 @@ func (self *cmdObjRunner) runAndDetectCredentialRequest(
340339
tr := io.TeeReader(handler.stdoutPipe, cmdWriter)
341340

342341
go utils.Safe(func() {
343-
self.processOutput(tr, handler.stdinPipe, promptUserForCredential, cmdObj.GetTask())
342+
self.processOutput(tr, handler.stdinPipe, promptUserForCredential, cmdObj)
344343
})
345344
})
346345
}
@@ -349,9 +348,10 @@ func (self *cmdObjRunner) processOutput(
349348
reader io.Reader,
350349
writer io.Writer,
351350
promptUserForCredential func(CredentialType) <-chan string,
352-
task gocui.Task,
351+
cmdObj *CmdObj,
353352
) {
354353
checkForCredentialRequest := self.getCheckForCredentialRequestFunc()
354+
task := cmdObj.GetTask()
355355

356356
scanner := bufio.NewScanner(reader)
357357
scanner.Split(bufio.ScanBytes)

pkg/commands/oscommands/cmd_obj_runner_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func TestProcessOutput(t *testing.T) {
120120
reader := strings.NewReader(scenario.output)
121121
writer := &strings.Builder{}
122122

123-
task := gocui.NewFakeTask()
124-
runner.processOutput(reader, writer, toChanFn(scenario.promptUserForCredential), task)
123+
cmdObj := &CmdObj{task: gocui.NewFakeTask()}
124+
runner.processOutput(reader, writer, toChanFn(scenario.promptUserForCredential), cmdObj)
125125

126126
if writer.String() != scenario.expectedToWrite {
127127
t.Errorf("expected to write '%s' but got '%s'", scenario.expectedToWrite, writer.String())

0 commit comments

Comments
 (0)