From: Han-Wen Nienhuys Date: Mon, 4 Aug 2008 01:43:40 +0000 (-0300) Subject: Improve error reporting for forked instances. X-Git-Tag: release/2.11.55-1~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=93d4b870dbcd205aad7618619dac0aee6f3faf94;p=lilypond.git Improve error reporting for forked instances. --- diff --git a/scm/lily.scm b/scm/lily.scm index b8f9a672b7..c324e2bab8 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -546,6 +546,8 @@ The syntax is the same as `define*-public'." (define (multi-fork count) + "Split this process in COUNT helpers. Returns either a list of pids, +or the number of the process." (define (helper count acc) (if (> count 0) (let* @@ -593,7 +595,6 @@ The syntax is the same as `define*-public'." (if (and (number? (ly:get-option 'job-count)) (>= (length files) (ly:get-option 'job-count))) - (let* ((count (ly:get-option 'job-count)) (split-todo (split-list files count)) @@ -605,8 +606,9 @@ The syntax is the same as `define*-public'." (if (number? joblist) (begin - (ly:set-option 'log-file (format "~a-~a" - (ly:get-option 'log-file) joblist)) + (ly:set-option + 'log-file (format "~a-~a" + (ly:get-option 'log-file) joblist)) (set! files (vector-ref split-todo joblist))) (begin @@ -616,25 +618,29 @@ The syntax is the same as `define*-public'." (let* ((stat (cdr (waitpid pid)))) (if (not (= stat 0)) - (set! errors (acons (list-element-index joblist pid) stat errors))))) + (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" + (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)))) + (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) @@ -646,18 +652,15 @@ The syntax is the same as `define*-public'." (dump-profile "lily-run-total" '(0 0) (profile-measurements))) (exit (if (null? errors) 0 1)))))) - (if (string-or-symbol? (ly:get-option 'log-file)) (ly:stderr-redirect (format "~a.log" (ly:get-option 'log-file)) "w")) - (let ((failed (lilypond-all files))) (if (ly:get-option 'trace-scheme-coverage) (begin (coverage:show-all (lambda (f) (string-contains f "lilypond")) ))) - (if (pair? failed) (begin @@ -671,6 +674,11 @@ The syntax is the same as `define*-public'." (define-public (lilypond-all files) (let* ((failed '()) (separate-logs (ly:get-option 'separate-log-files)) + (ping-log + (if separate-logs + (open-file (if (string-or-symbol? (ly:get-option 'log-file)) + (format "~a.log" (ly:get-option 'log-file)) + "/dev/tty") "a") #f)) (do-measurements (ly:get-option 'dump-profile)) (handler (lambda (key failed-file) (set! failed (append (list failed-file) failed))))) @@ -687,6 +695,9 @@ The syntax is the same as `define*-public'." (if separate-logs (ly:stderr-redirect (format "~a.log" base) "w")) + (if ping-log + (format ping-log "Procesing ~a\n" base)) + (if (ly:get-option 'trace-memory-frequency) (mtrace:start-trace (ly:get-option 'trace-memory-frequency))) @@ -718,12 +729,9 @@ The syntax is the same as `define*-public'." files) ;; we want the failed-files notice in the aggregrate logfile. - (if (ly:get-option 'separate-logs) - (ly:stderr-redirect - (if (string-or-symbol? (ly:get-option 'log-file)) - (format "~a.log" (ly:get-option 'log-file)) - "/dev/tty") "a")) - + (if ping-log + (format ping-log "Failed files: ~a\n" failed)) + (if (ly:get-option 'dump-profile) (dump-profile "lily-run-total" '(0 0) (profile-measurements)))