diff options
author | Eduardo Julian | 2022-01-15 02:17:35 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-01-15 02:17:35 -0400 |
commit | e1af5374ba4d969f866867db47af7ecf60cc9933 (patch) | |
tree | 8aa83faa67253d5beab931f4950bb319204a2944 /stdlib/source/program | |
parent | 68a17d42bab808290de0d975f4083b52b37d0706 (diff) |
Fixed a logging/reporting issue for Lux/JS.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/compositor.lux | 24 |
2 files changed, 17 insertions, 8 deletions
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 15a671615..ba461d461 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -202,6 +202,7 @@ ... But it's written this way because the more straightforward way (i.e. by using (try.with async.monad)) ... eventually led to the function hanging/freezing. ... I'm not sure why it happened, but I got this weirder implementation to work. + ... TODO: Improve this implementation. (let [[read! write!] (: [(Async (Try Any)) (async.Resolver (Try Any))] (async.async [])) 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 [<else> (in (debug.log! report))] + (for [@.js (case console.default + {.#None} + <else> + + {.#Some console} + (console.write_line report console))] + <else>))] + (io.run! (# world/program.default exit +1)))) {try.#Success output} (in output)))) |