zilch-cli-ninja: Use the logger

Change-Id: I4cfcd8495d05500b14ba4c9b39726bc86a6a6964
This commit is contained in:
puck 2025-11-20 12:56:53 +00:00
parent c4ec32eac3
commit 83993d7739

View file

@ -28,7 +28,18 @@
(when (assoc 'help options) (print-help #f))
;; Set up the logger.
(define (set-print-logs val) #f)
(let ((prev-error-handler (current-exception-handler))) (current-exception-handler (lambda data (set-print-logs #t) (apply prev-error-handler data))))
(when (terminal-port? (current-error-port))
(let-values (((new-out new-err statusbar-set-print-logs logger) (statusbar-logger (current-output-port) (current-error-port) (assoc 'print-build-logs options))))
(current-output-port new-out)
(current-error-port new-err)
(set! set-print-logs statusbar-set-print-logs)
(*logger* logger)))
(when (null? args)
(set-print-logs #t)
(print-help "No subcommand"))
;; Flags passed to the nix daemon:
@ -70,7 +81,7 @@
(when (eq? (car c) 'project)
(let loop ((rewrites (ninja-build-config-rewrites config)))
(cond
((null? rewrites) (error "Subproject not found" (cdr c)))
((null? rewrites) (set-print-logs #t) (error "Subproject not found" (cdr c)))
((string=? (caar rewrites) (cdr c)) (set! config (cdar rewrites)))
(else (loop (cdr rewrites)))))))
options)