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