diff --git a/README.md b/README.md index 1763e95..0418c67 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,8 @@ The callback `:success` is called with a map containing: - `:value`: a return value from the pod var -The callback `:error` is called with a map containing: +The callback `:error` is called in case the pod sends an error, a map +containing: - `:ex-message`: an error message - `:ex-data`: an arbitrary additional error data map. Typically it will contain @@ -371,9 +372,9 @@ The callback `:error` is called with a map containing: If desired, `:ex-message` and `:ex-data` can be reified into a `java.lang.Exception` using `ex-info`. -The callback `:done` is called with one argument which is currently -undefined. This callback can be used to determine if the pod is done sending -values. +The callback `:done` is called with one argument, a map. This callback can be +used to determine if the pod is done sending values, in case it wants to send +multiple. The callback is only called if no errors were sent by the pod. In the above example the wrapper function calls the pod identified by `"pod.babashka.filewatcher"`. It calls the var diff --git a/deps.edn b/deps.edn index 85e11d9..8a39f0b 100644 --- a/deps.edn +++ b/deps.edn @@ -1,6 +1,5 @@ {:deps {nrepl/bencode {:mvn/version "1.1.0"} - cheshire {:mvn/version "5.10.0"} - org.clojure/core.async {:mvn/version "1.1.587"}} + cheshire {:mvn/version "5.10.0"}} :aliases {:sci {:extra-deps diff --git a/src/babashka/pods/impl.clj b/src/babashka/pods/impl.clj index 6f94ace..5506afc 100644 --- a/src/babashka/pods/impl.clj +++ b/src/babashka/pods/impl.clj @@ -3,7 +3,6 @@ (:refer-clojure :exclude [read]) (:require [bencode.core :as bencode] [cheshire.core :as cheshire] - [clojure.core.async :as async] [clojure.edn :as edn])) (set! *warn-on-reflection* true) @@ -86,7 +85,7 @@ (and error? error-handler) (error-handler {:ex-message ex-message :ex-data ex-data}))) - (when done? + (when (and done? (not error?)) (when promise? (deliver chan nil)) (when done-handler diff --git a/test/babashka/pods/sci_test.clj b/test/babashka/pods/sci_test.clj index 9500582..f5ee07a 100644 --- a/test/babashka/pods/sci_test.clj +++ b/test/babashka/pods/sci_test.clj @@ -1,7 +1,6 @@ (ns babashka.pods.sci-test (:require [babashka.pods.sci :as pods] [babashka.pods.test-common :refer [test-program assertions]] - [clojure.core.async :as async] [clojure.test :refer [deftest]] [sci.core :as sci])) @@ -14,7 +13,5 @@ test-program {:namespaces {'babashka.pods {'load-pod pods/load-pod - 'invoke pods/invoke} - 'clojure.core.async - {'