Skip to content

Commit

Permalink
Ensure exec supports :cmd opt (#134)
Browse files Browse the repository at this point in the history
I think this was fixed by 3f093b7.

Added test and updated docstring.

Closes #125
  • Loading branch information
lread authored May 27, 2023
1 parent 5c70bdb commit d47cb0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/babashka/process.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@
Supported `opts`
- `:arg0`: override first argument (the executable). No-op on Windows.
- `:env`,`:extra-env`,`:escape`,`:pre-start-fn` : see `process`."
- `:cmd`, `:env`,`:extra-env`, `:escape`,`:pre-start-fn` : see `process`."
{:arglists '([opts? & args])}
[& args]
(let [{:keys [cmd opts]} (parse-args args)]
Expand Down
8 changes: 8 additions & 0 deletions test/babashka/process_exec_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,11 @@
(let [java-dir (-> (fs/which "java") fs/parent fs/absolutize str)]
(shell/with-sh-dir java-dir
(= expected (run-exec "./java -version")))))))

(deftest cmd-opt-test
(when-let [bb (u/find-bb)]
(is (= {:exit 0
:out (u/ols "o-one\no-two\n")
:err (u/ols "e-one\n")}
(run-exec {:cmd [bb u/wd ":out" "o-one" ":err" "e-one" ":out" "o-two"]
:out :string :err :string})))))

0 comments on commit d47cb0b

Please sign in to comment.