aboutsummaryrefslogtreecommitdiff
path: root/luxc/src
diff options
context:
space:
mode:
authorEduardo Julian2016-12-25 20:05:08 -0400
committerEduardo Julian2016-12-25 20:05:08 -0400
commit6130c650d29e6b09e65fcd3269b0b4bdb2fc27a0 (patch)
treea7004a82dec2e4d3e80055cd2142a0859e3a5c67 /luxc/src
parent2eeb6682e3db5aaba550ebc58a6e1322430c5b17 (diff)
- Improved the way error messages are shown when compilation fails.
Diffstat (limited to 'luxc/src')
-rw-r--r--luxc/src/lux/compiler.clj25
1 files changed, 14 insertions, 11 deletions
diff --git a/luxc/src/lux/compiler.clj b/luxc/src/lux/compiler.clj
index 1c04df819..78fe301fd 100644
--- a/luxc/src/lux/compiler.clj
+++ b/luxc/src/lux/compiler.clj
@@ -255,15 +255,18 @@
))
)))
-(defn compile-program [mode program-module resources-dir source-dirs target-dir]
- (do (init! resources-dir target-dir)
- (let [m-action (|do [_ (compile-module source-dirs "lux")]
- (compile-module source-dirs program-module))]
- (|case (m-action (&/init-state mode))
- (&/$Right ?state _)
- (do (println "Compilation complete!")
- (&&cache/clean ?state))
+(let [!err! *err*]
+ (defn compile-program [mode program-module resources-dir source-dirs target-dir]
+ (do (init! resources-dir target-dir)
+ (let [m-action (|do [_ (compile-module source-dirs "lux")]
+ (compile-module source-dirs program-module))]
+ (|case (m-action (&/init-state mode))
+ (&/$Right ?state _)
+ (do (println "Compilation complete!")
+ (&&cache/clean ?state))
- (&/$Left ?message)
- (do (&/|log! (str "Compilation failed:\n" ?message))
- (System/exit 1))))))
+ (&/$Left ?message)
+ (binding [*out* !err!]
+ (do (println (str "Compilation failed:\n" ?message))
+ (flush)
+ (System/exit 1))))))))