From 9b1c71a381ee5baf3e4d813e39f844468b19fdfc Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 27 Oct 2017 16:20:02 -0400 Subject: [PATCH] Catch all errors so credentials are tried --- .../pkg/private/checkout-credentials.rkt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/racket/collects/pkg/private/checkout-credentials.rkt b/racket/collects/pkg/private/checkout-credentials.rkt index 08b7c775cd..50e2dcfc1b 100644 --- a/racket/collects/pkg/private/checkout-credentials.rkt +++ b/racket/collects/pkg/private/checkout-credentials.rkt @@ -1,24 +1,26 @@ #lang racket/base - (require net/git-checkout racket/list "config.rkt") (provide call-with-git-checkout-credentials) -(define (call-with-git-checkout-credentials thunk) +(define (call-with-git-checkout-credentials t) (let loop ([credentials-list (cons #f (get-git-checkout-credentials))]) (define credentials (first credentials-list)) - (with-handlers ([exn:fail:git? (λ (exn) - (if (empty? (rest credentials-list)) - (raise exn) - (loop (rest credentials-list))))]) + (with-handlers ([exn:fail? + (λ (x) + (if (empty? (rest credentials-list)) + (raise x) + (loop (rest credentials-list))))]) (define c (make-custodian)) (parameterize ([current-custodian c] - [current-git-username (and credentials (hash-ref credentials 'username))] - [current-git-password (and credentials (hash-ref credentials 'password))]) + [current-git-username + (and credentials (hash-ref credentials 'username))] + [current-git-password + (and credentials (hash-ref credentials 'password))]) (dynamic-wind void - thunk + t (lambda () (custodian-shutdown-all c)))))))