From 39f3f150edf0051e62a7e0de3a424d8fdb3cec5d Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 18 Jul 2023 18:53:35 +0200 Subject: [PATCH] Fix crash when a background fetch prompts for credentials This happens consistently for my when I close my MacBook's lid. It seems that MacOS locks the user's keychain in this case, and since I have my keychain provide the pass phrases for my ssh keys, fetching fails because it tries to prompt me for a pass phrase. This all worked correctly already, we have the FailOnCredentialRequest() mechanism specifically for this situation, so all is great. The only problem was that it was trying to pause the ongoing task while prompting the user for input; but the task is nil for a background fetch (and should be). --- pkg/commands/oscommands/cmd_obj_runner.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/commands/oscommands/cmd_obj_runner.go b/pkg/commands/oscommands/cmd_obj_runner.go index 3456bcd9e..19c67819d 100644 --- a/pkg/commands/oscommands/cmd_obj_runner.go +++ b/pkg/commands/oscommands/cmd_obj_runner.go @@ -331,9 +331,13 @@ func (self *cmdObjRunner) processOutput( askFor, ok := checkForCredentialRequest(newBytes) if ok { responseChan := promptUserForCredential(askFor) - task.Pause() + if task != nil { + task.Pause() + } toInput := <-responseChan - task.Continue() + if task != nil { + task.Continue() + } // If the return data is empty we don't write anything to stdin if toInput != "" { _, _ = writer.Write([]byte(toInput))