From e1af5374ba4d969f866867db47af7ecf60cc9933 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 15 Jan 2022 02:17:35 -0400 Subject: Fixed a logging/reporting issue for Lux/JS. --- stdlib/source/program/compositor.lux | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'stdlib/source/program/compositor.lux') diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 54fc903ad..2b6850cf8 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -22,9 +22,8 @@ ["[0]" instant]] ["[0]" world "_" ["[0]" file] - ["[1]/[0]" program] - ... ["[0]" console] - ] + ["[0]" console] + ["[1]/[0]" program]] [tool [compiler ["[0]" phase] @@ -59,14 +58,23 @@ (def: (or_crash! failure_description action) (All (_ a) (-> Text (Async (Try a)) (Async a))) - (do async.monad + (do [! async.monad] [?output action] (case ?output {try.#Failure error} - (exec (debug.log! (format text.new_line - failure_description text.new_line - error text.new_line)) - (io.run! (# world/program.default exit +1))) + (let [report (format text.new_line + failure_description text.new_line + error text.new_line)] + (do ! + [_ (with_expansions [ (in (debug.log! report))] + (for [@.js (case console.default + {.#None} + + + {.#Some console} + (console.write_line report console))] + ))] + (io.run! (# world/program.default exit +1)))) {try.#Success output} (in output)))) -- cgit v1.2.3