automaton-build.tasks.impl.headers.cmds
blocking-cmd
(blocking-cmd cmd dir err-message verbose?)
Execute a command in the blocking mode, so the result is returned when the function is returned.
Print the command cmd
if verbose is true
, and execute cmd
in directory dir
. The prefixs
are added, the err-message
also if an error occur.
Returns a map with:
- :cmd-str
- :out
- :dir
- :exit
- :err
chain-cmds
(chain-cmds cmd-chain non-zero-exit-message verbose?)
Execute a chain of commands, echo the errors of the last command if if happens, with the non-zero-exit-message
. If the non-zero-exit-message
is nil
, no error message is printed.
Returns the chain of results.
clj-parameterize
(clj-parameterize par)
Turns par
into a parameter understood by a clojure cli
.
echoed-cmd
(echoed-cmd cmd-str)
Wrap a command string cmd-str
before printing to be seen as a uri in the terminal.
exec-cmd-str
(exec-cmd-str cmd-str)
Returns the string of the execution of a command cmd-str
first-failing
(first-failing chain-res)
Returns the result of the first failing result of a command, or the last succesful one.
force-dirs
(force-dirs cmd-chain dir)
kill
(kill process)
long-living-cmd
(long-living-cmd cmd dir refresh-delay verbose? out-filter-fn err-filter-fn)
Execute and print command cmd
that is a long living one. So all outputs will be displayed with prefixs.
As there are listeners to achieve that, the refresh-delay
is specifying the delay between two refreshs.
With out-filter-fn
you can decide which lines you display or not, knowing that (constantly true) will accept them all. With err-filter-fn
you can decide which lines you display or not, knowing that (constantly true) will accept them all.
If there is no need or no will to wait for the end of the command, just call it in a future.
print-cmd-str
(print-cmd-str cmd-str)
Print the command string cmd-str
.
print-errors-if-cmd-failed
(print-errors-if-cmd-failed {:keys [exit out err cmd-str dir]} non-zero-exit-message)
Print the result of a command if an error occured:
- if the command is not found and an exception is raised,
- or if the command is found and return a non zero exit code.
No need to publish this function it is included in blocking-cmd
. Returns nil
.
print-exec-cmd-str
(print-exec-cmd-str cmd-str dir)
Print a message telling the execution of the command string cmd-str
in directory dir
.
simple-shell
(simple-shell cmd)
(simple-shell cmd args)
success
(success result)
Returns true
if the result is a success