scicloj / notespace

using your namespace as a notebook
Eclipse Public License 2.0
148 stars 10 forks source link

requiring the notespace ns, prevents JVM from shutting down #56

Open behrica opened 3 years ago

behrica commented 3 years ago

Executing his code via clojure command line tool clj, throws exception and prevents JVM shutdown

(ns scicloj.metamorph-examples.try-exit
(:require [notespace.api :as note]))
(shutdown-agents)

without (shutdown-agents), the JVM does not shutdown, but no exception is seen

behrica commented 3 years ago

see here: https://clojurians.zulipchat.com/#narrow/stream/224153-notespace-dev/topic/requiring.20.22notespace.22.20.2B.20prevents.20JVM.20from.20exiting

behrica commented 3 years ago

adding System/exit works:

(ns scicloj.metamorph-examples.try-exit
(:require [notespace.api :as note]))
(System/exit 0)
behrica commented 3 years ago

As a workaround this works.

clj -e '(load-file "src/scicloj/metamorph_examples/titanic.clj")(System/exit 0)'
behrica commented 3 years ago

As we have now the cli namespace in notespace we can now render notespaces to html via a commandline like:

clj -Atest -e "(require 'notespace.cli)(notespace.cli/eval-and-render-a-notespace {:ns 'scicloj.ml.titanic :config-updates {:source-base-path \"userguide\"}})(System/exit 0)"

This is cools specifically if using notespace for documentation of something, so teh html generation can be part of build.

Due to this issue, we need teh (System/exit 0), which is a bit of a pitty.

daslu commented 3 years ago

Thanks, @behrica. I hope we solve such things in the near future.