Create a gist now

Instantly share code, notes, and snippets.

Lieningen breaks function

(using .. in gist file names instead of /)

With this project setup and running

lein run

I get the error

Copying 1 file to /home/sharat/labs/experiments/clojure/thread-sh/lib
Exception in thread "Thread-0" java.lang.RuntimeException: java.util.concurrent.RejectedExecutionException
Caused by: java.util.concurrent.RejectedExecutionException
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(
        at java.util.concurrent.ThreadPoolExecutor.reject(
        at java.util.concurrent.ThreadPoolExecutor.execute(
        at java.util.concurrent.AbstractExecutorService.submit(
        at clojure.core$future_call.invoke(core.clj:5406)
        at clojure.lang.RestFn.invoke(
        at thread_sh.core$show_cmd.invoke(core.clj:6)
        ... 1 more

But, running a single .clj file with the same function call, it works just fine in both the cases, i.e., with and without starting a new thread.

(defproject thread-sh "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.2.1"]]
:main thread-sh.core)
(ns thread-sh.core
(:require [ :as shell]))
(defn show-cmd
(-> (shell/sh "ls")
(defn -main
; calling it directly like `(show-cmd)` works fine
(.start (Thread. show-cmd)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment