Fix preloads

This commit is contained in:
Michiel Borkent 2020-02-04 11:09:29 +01:00
parent 1d3eaae943
commit ba3eac83b1

View file

@ -282,6 +282,8 @@ Everything after that is bound to *command-line-args*."))
(handle-pipe!)
#_(binding [*out* *err*]
(prn "M" (meta (get bindings 'future))))
(sci/with-bindings {reflection-var false
vars/current-ns (vars/->SciNamespace 'user)}
(let [t0 (System/currentTimeMillis)
{:keys [:version :shell-in :edn-in :shell-out :edn-out
:help? :file :command-line-args
@ -372,15 +374,14 @@ Everything after that is bound to *command-line-args*."))
exit-code
;; handle preloads
(if exit-code exit-code
(do (when preloads (try (eval-string* sci-ctx preloads)
(do (when preloads
(try
(eval-string* sci-ctx preloads)
(catch Throwable e
(error-handler* e verbose?))))
nil))
exit-code
(or exit-code
(sci/with-bindings {reflection-var false
vars/current-ns (vars/->SciNamespace 'user)}
(or
(second
(cond version
[(print-version) 0]
@ -415,7 +416,7 @@ Everything after that is bound to *command-line-args*."))
(error-handler* e verbose?)))
uberscript [nil 0]
:else [(repl/start-repl! sci-ctx) 0]))
1)))
1)
t1 (System/currentTimeMillis)]
(flush)
(when uberscript
@ -428,7 +429,7 @@ Everything after that is bound to *command-line-args*."))
(spit uberscript-out expression :append true)))
(when time? (binding [*out* *err*]
(println "bb took" (str (- t1 t0) "ms."))))
exit-code))
exit-code)))
(defn -main
[& args]