diff --git a/process b/process index eba04e6c..3559a706 160000 --- a/process +++ b/process @@ -1 +1 @@ -Subproject commit eba04e6c35814296e5bb383804f801aee912cba1 +Subproject commit 3559a70686e435504b1bed320d2e513c5bf2bb15 diff --git a/script/postgresql_test b/script/postgresql_test index 70a8f37f..42dc024d 100755 --- a/script/postgresql_test +++ b/script/postgresql_test @@ -1,5 +1,5 @@ #!/usr/bin/env bash -BABASHKA_FEATURE_JDBC=true -BABASHKA_FEATURE_POSTGRESQL=true +export BABASHKA_FEATURE_JDBC=true +export BABASHKA_FEATURE_POSTGRESQL=true lein test :only babashka.postgresql-test diff --git a/src/babashka/impl/tasks.clj b/src/babashka/impl/tasks.clj index 537b8499..e2bca478 100644 --- a/src/babashka/impl/tasks.clj +++ b/src/babashka/impl/tasks.clj @@ -61,7 +61,12 @@ :shutdown p/destroy-tree}) (defn shell [cmd & args] - (let [[opts cmd args] + (let [[prev cmd args] + (if (and (map? cmd) + (:proc cmd)) + [cmd (first args) (rest args)] + [nil cmd args]) + [opts cmd args] (if (map? cmd) [cmd (first args) (rest args)] [nil cmd args]) @@ -75,6 +80,9 @@ (update opts :err io/file) opts) opts) + opts (if prev + (assoc opts :in nil) + opts) cmd (if (.exists (io/file cmd)) [cmd] (p/tokenize cmd)) @@ -82,7 +90,7 @@ local-log-level (:log-level opts)] (sci/binding [log-level (or local-log-level @log-level)] (apply log-info cmd) - (handle-non-zero (p/process cmd (merge default-opts opts)) opts)))) + (handle-non-zero (p/process prev cmd (merge default-opts opts)) opts)))) (defn clojure [cmd & args] (let [[opts cmd args] diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index e7ae0856..0a0005cb 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -196,6 +196,13 @@ (test-utils/with-config '{:tasks {b (System/getProperty "babashka.task")}} (let [s (bb "run" "--prn" "b")] (is (= "b" s))))) + (testing "shell pipe test" + (test-utils/with-config '{:tasks {a (-> (shell {:out :string} + "echo hello") + (shell {:out :string} "cat") + :out)}} + (let [s (bb "run" "--prn" "a")] + (is (= "hello\n" s))))) (deftest list-tasks-test (test-utils/with-config {}