Fork me on GitHub
#babashka
<
2023-04-28
>
pesterhazy09:04:12

Wondering if this should work:

(binding [babashka.process/*defaults* (merge babashka.process/*defaults* {:dir "/tmp"})] (babashka.process/shell "bash" "-c" "echo $PWD"))
Expected (?): /tmp Actual: whatever dir I'm in Should this be printing /tmp instead of the cwd? (Also, is "cd'ing" like this a good idea?)

borkdude09:04:47

Currently this doesn't work since the process function should take into account the SCI binding, which it currently doesn't, only for process unfortunately. But it can be fixed similar to this: https://github.com/babashka/babashka/blob/2b24a84c117ca149e8c307e4f25f680703eaa12e/src/babashka/impl/process.clj#L11-L21

borkdude09:04:57

Issue / PR (optional) welcome

borkdude11:04:14

pushing a solution:

user=> (binding [p/*defaults* (assoc p/*defaults* :dir "src")] [(:out (p/sh "pwd")) (:out (p/sh "pwd"))])
["/Users/borkdude/dev/babashka/src\n" "/Users/borkdude/dev/babashka/src\n"]

👍 2