mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
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).
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user