Make parallel compile not call exit.

Closes PR 13373.
This commit is contained in:
Eric Dobson 2014-01-13 00:04:08 -08:00
parent aa3505d937
commit f0ebfee9ac
3 changed files with 20 additions and 19 deletions

View File

@ -98,19 +98,20 @@
dest)))))))] dest)))))))]
;; Parallel make: ;; Parallel make:
[else [else
(parallel-compile-files (or (parallel-compile-files
source-files source-files
#:worker-count (worker-count) #:worker-count (worker-count)
#:handler (lambda (type work msg out err) #:handler (lambda (type work msg out err)
(match type (match type
['done (when (verbose) (printf " Made ~a\n" work))] ['done (when (verbose) (printf " Made ~a\n" work))]
['output (printf " Output from: ~a\n~a~a" work out err)] ['output (printf " Output from: ~a\n~a~a" work out err)]
[else (printf " Error compiling ~a\n~a\n~a~a" work msg out err)])) [else (printf " Error compiling ~a\n~a\n~a~a" work msg out err)]))
#:options (let ([cons-if-true (lambda (bool carv cdrv) #:options (let ([cons-if-true (lambda (bool carv cdrv)
(if bool (if bool
(cons carv cdrv) (cons carv cdrv)
cdrv))]) cdrv))])
(cons-if-true (cons-if-true
(very-verbose) (very-verbose)
'very-verbose 'very-verbose
(cons-if-true (disable-inlining) 'disable-inlining null))))]) (cons-if-true (disable-inlining) 'disable-inlining null))))
(exit 1))])

View File

@ -465,7 +465,7 @@ functionality of @exec{raco setup} and @exec{raco make}.}
[err string?]) [err string?])
void?) void?)
void]) void])
void?]{ (or/c void? #f)]{
The @racket[parallel-compile] utility function is used by @exec{raco make} to The @racket[parallel-compile] utility function is used by @exec{raco make} to
compile a list of paths in parallel. The optional compile a list of paths in parallel. The optional
@ -476,6 +476,7 @@ parallel compilation. The callback, @racket[handler], is called with the symbol
successful compilation produces stdout/stderr output, @racket['error] when a successful compilation produces stdout/stderr output, @racket['error] when a
compilation error has occured, or @racket['fatal-error] when a unrecoverable compilation error has occured, or @racket['fatal-error] when a unrecoverable
error occurs. The other arguments give more information for each status update. error occurs. The other arguments give more information for each status update.
The return value is @racket[(void)] if it was successful, or @racket[#f] if there was an error.
@racketblock[ @racketblock[
(parallel-compile-files (parallel-compile-files

View File

@ -298,8 +298,7 @@
#:worker-count [worker-count (processor-count)] #:worker-count [worker-count (processor-count)]
#:handler [handler void] #:handler [handler void]
#:options [options '()]) #:options [options '()])
(or (parallel-build (make-object file-list-queue% list-of-files handler options) worker-count) (parallel-build (make-object file-list-queue% list-of-files handler options) worker-count))
(exit 1)))
(define (parallel-compile worker-count setup-fprintf append-error collects-tree) (define (parallel-compile worker-count setup-fprintf append-error collects-tree)
(setup-fprintf (current-output-port) #f "--- parallel build using ~a jobs ---" worker-count) (setup-fprintf (current-output-port) #f "--- parallel build using ~a jobs ---" worker-count)