- (split-todo (split-list files count))
- (joblist (multi-fork count))
- (errors '()))
- (if (not (string-or-symbol? (ly:get-option 'log-file)))
- (ly:set-option 'log-file "lilypond-multi-run"))
- (if (number? joblist)
- (begin (ly:set-option
- 'log-file (format "~a-~a"
- (ly:get-option 'log-file) joblist))
- (set! files (vector-ref split-todo joblist)))
- (begin (ly:progress "\nForking into jobs: ~a\n" joblist)
- (for-each
- (lambda (pid)
- (let* ((stat (cdr (waitpid pid))))
- (if (not (= stat 0))
- (set! errors
- (acons (list-element-index joblist pid)
- stat errors)))))
- joblist)
- (for-each
- (lambda (x)
- (let* ((job (car x))
- (state (cdr x))
- (logfile (format "~a-~a.log"
- (ly:get-option 'log-file) job))
- (log (ly:gulp-file logfile))
- (len (string-length log))
- (tail (substring log (max 0 (- len 1024)))))
- (if (status:term-sig state)
- (ly:message
- "\n\n~a\n"
- (format (_ "job ~a terminated with signal: ~a")
- job (status:term-sig state)))
- (ly:message
- (_ "logfile ~a (exit ~a):\n~a")
- logfile (status:exit-val state) tail))))
- errors)
- (if (pair? errors)
- (ly:error "Children ~a exited with errors."
- (map car errors)))
- ;; must overwrite individual entries
- (if (ly:get-option 'dump-profile)
- (dump-profile "lily-run-total"
- '(0 0) (profile-measurements)))
- (if (null? errors)
- (ly:exit 0 #f)
- (ly:exit 1 #f))))))
+ (split-todo (split-list files count))
+ (joblist (multi-fork count))
+ (errors '()))
+ (if (not (string-or-symbol? (ly:get-option 'log-file)))
+ (ly:set-option 'log-file "lilypond-multi-run"))
+ (if (number? joblist)
+ (begin (ly:set-option
+ 'log-file (format #f "~a-~a"
+ (ly:get-option 'log-file) joblist))
+ (set! files (vector-ref split-todo joblist)))
+ (begin (ly:progress "\nForking into jobs: ~a\n" joblist)
+ (for-each
+ (lambda (pid)
+ (let* ((stat (cdr (waitpid pid))))
+ (if (not (= stat 0))
+ (set! errors
+ (acons (list-element-index joblist pid)
+ stat errors)))))
+ joblist)
+ (for-each
+ (lambda (x)
+ (let* ((job (car x))
+ (state (cdr x))
+ (logfile (format #f "~a-~a.log"
+ (ly:get-option 'log-file) job))
+ (log (ly:gulp-file logfile))
+ (len (string-length log))
+ (tail (substring log (max 0 (- len 1024)))))
+ (if (status:term-sig state)
+ (ly:message
+ "\n\n~a\n"
+ (format #f (_ "job ~a terminated with signal: ~a")
+ job (status:term-sig state)))
+ (ly:message
+ (_ "logfile ~a (exit ~a):\n~a")
+ logfile (status:exit-val state) tail))))
+ errors)
+ (if (pair? errors)
+ (ly:error "Children ~a exited with errors."
+ (map car errors)))
+ ;; must overwrite individual entries
+ (if (ly:get-option 'dump-profile)
+ (dump-profile "lily-run-total"
+ '(0 0) (profile-measurements)))
+ (if (null? errors)
+ (ly:exit 0 #f)
+ (ly:exit 1 #f))))))