failsafe if "which" is not executable.

This commit is contained in:
interp 2003-02-19 18:45:57 +00:00
parent 2d7a37f060
commit 945b4a2ade
1 changed files with 8 additions and 5 deletions

View File

@ -11,6 +11,7 @@
let-opt let-opt
receiving receiving
primitives primitives
handle-fatal-error
) )
(begin (begin
@ -310,10 +311,13 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
(profile req)) (profile req))
(define (search-executable exec-name) (define (search-executable exec-name)
(with-fatal-error-handler
;; If `which' is unavailable, return nothing.
(lambda (condition decline) "")
(receive (status ports) (run/collecting (1) (which ,exec-name)) (receive (status ports) (run/collecting (1) (which ,exec-name))
(if (zero? status) (if (zero? status)
(read-line ports) (read-line ports)
""))) ""))))
(define (emph text) (define (emph text)
`(font (@ (color "red")) ,text)) `(font (@ (color "red")) ,text))
@ -327,5 +331,4 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
`(tr (td (@ (colspan 2)) `(tr (td (@ (colspan 2))
,(emph "Note: There is no executable.")))))) ,(emph "Note: There is no executable."))))))
;; TODO: check `where' tool
)) ))