Back

shell (clj)

(source)

function

(shell opts? & args)
Convenience function around `process` that was originally in `babashka.tasks`. Defaults to inheriting I/O: input is read and output is printed while the process runs. Defaults to throwing on non-zero exit codes. Kills all subprocesses on shutdown. Optional options map can be passed as the first argument, followed by multiple command line arguments. The first command line argument is automatically tokenized. Counter to what the name of this function may suggest, it does not start a new (bash, etc.) shell, it just shells out to a program. As such, it does not support bash syntax like `ls *.clj`. Supported options: - `:continue`: if `true`, suppresses throwing on non-zero process exit code. - see `process` for other options Examples: - `(shell "ls -la")` ;; `"ls -la"` is tokenized as `["ls" "-la"]` - `(shell {:out "/tmp/log.txt"} "git commit -m" "WIP")` ;; `"git commit -m"` is tokenized as `["git" "commit" "-m"]` and `"WIP"` is an additional argument Also see the `shell` entry in the babashka book [here](https://book.babashka.org/#_shell).

Examples