ambrevar/shell: Add cmd>.
parent
b368c7f349
commit
40838e883c
|
@ -235,6 +235,7 @@ Also see `*shell-command-flags*'.")
|
|||
"Wrapper around `cmd:$cmd' to execute SHELL-COMMAND in `*shell*'."
|
||||
(cmd:$cmd (format-shell-command shell-command)))
|
||||
|
||||
(export-always 'cmd&)
|
||||
(defun cmd& (cmd) ; TODO: Support (cmd &rest args) lambda list.
|
||||
"Like `cmd:cmd&' but run and monitor in a shell.
|
||||
When Lisp is exited, the command is automatically terminated.
|
||||
|
@ -245,6 +246,20 @@ List of background process is maintained in `*process-list*'."
|
|||
(push handle *process-list*)
|
||||
handle))
|
||||
|
||||
(export-always 'cmd>)
|
||||
(defun cmd> (cmd &rest args) ; TODO: "|" is not convenient in CL, use "/" or "-"?
|
||||
"Like `cmd:cmd&' but return the output as a stream.
|
||||
Return the process handler as second value.
|
||||
Use
|
||||
|
||||
(uiop:slurp-stream-string STREAM :stripped t)
|
||||
|
||||
to get the final output as a string."
|
||||
(let ((handler (apply #'cmd:cmd& cmd (append args
|
||||
(list :output :stream)))))
|
||||
(values (uiop:process-info-output handler)
|
||||
handler)))
|
||||
|
||||
(export-always 'disk-usage)
|
||||
(defun disk-usage (files)
|
||||
"Return disk usage of FILES in octets.
|
||||
|
|
Loading…
Reference in New Issue