Fork me on GitHub
#boot
<
2018-12-11
>
nitaai16:12:37

Hi guys, i am trying to implement a boot run task as an equivalent to lein run. It basically works, but instead of remaining in the foreground like with lein, boot returns immediately after having started the http server:

~/s/w/L/leihs-sql-assistant (master) $ boot [ run -- -d jdbc: ]
[INFO  Dec-11-Tue_17:20:33 leihs.sql-assistant.run clojure-agent-send-off-pool-0] Invoking run with options:  {:http-base-url {:protocol http, :host localhost, :port 3250, :context nil, :url }, :database-url {:protocol jdbc, :sub-protocol postgresql, :database leihs_prod, :username nil, :password mkmit, :host localhost, :port 5432, :max-pool-size 5}}
[INFO  Dec-11-Tue_17:20:33 leihs.core.ds clojure-agent-send-off-pool-0] Initializing db pool  {:protocol jdbc, :sub-protocol postgresql, :database leihs_prod, :username nil, :password mkmit, :host localhost, :port 5432, :max-pool-size 5}  ...
[INFO  Dec-11-Tue_17:20:33 leihs.core.ds clojure-agent-send-off-pool-0] Initializing db pool done.
[INFO  Dec-11-Tue_17:20:33 leihs.core.http-server clojure-agent-send-off-pool-0] starting server  {:ssl? false, :join? false, :port 3250, :host localhost}
[INFO  Dec-11-Tue_17:20:33 leihs.core.http-server Thread-19] #object[leihs.core.http_server$stop 0x515075ea [email protected]]
~/s/w/L/leihs-sql-assistant (master) $

nitaai16:12:35

Ok, i have just found out about the wait task. Using that it seems to work. The new version of the task:

(deftask run
  "Run the application with given opts."
  []
  (->> *args*
         (cons "run")
         (apply leihs.sql-assistant.main/-main))
  (wait))