summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-07-18 18:53:35 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-07-18 18:53:35 +0200
commit39f3f150edf0051e62a7e0de3a424d8fdb3cec5d (patch)
tree5f05dcdf8bc187c37f51d23da37af487e2b01617
parent7e9f66942119d8ce6b00fee61554f7947d2d5f56 (diff)
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).
-rw-r--r--pkg/commands/oscommands/cmd_obj_runner.go8
1 files 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))