From e0a0c5f999854a93f89229cd150e669f0c1836b3 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Fri, 4 Apr 2014 10:43:35 -0400 Subject: [PATCH] Make locating dot executable more robust. --- pkgs/contract-profile/dot.rkt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/contract-profile/dot.rkt b/pkgs/contract-profile/dot.rkt index 9c6a24fa3c..9149083483 100644 --- a/pkgs/contract-profile/dot.rkt +++ b/pkgs/contract-profile/dot.rkt @@ -18,11 +18,15 @@ (define dot.exe (if (eq? (system-type) 'windows) "dot.exe" "dot")) (define dot - (or (find-executable-path dot.exe) - (ormap (λ (x) - (define candidate (build-path x dot.exe)) - (and (file-exists? candidate) candidate)) - dot-paths))) + (with-handlers ([(lambda (e) ; may not have permission + (and (exn:fail? e) + (regexp-match "access denied" (exn-message e)))) + (lambda _ #f)]) + (or (find-executable-path dot.exe) + (ormap (λ (x) + (define candidate (build-path x dot.exe)) + (and (file-exists? candidate) candidate)) + dot-paths)))) (define (render-dot input-file) (when (and dot (not (dry-run?)))