1 (in-package #:trivial-shell
)
3 (defun %shell-command
(command input
)
4 (let* ((process (create-shell-process command t input
))
5 (output (file-to-string-as-lines
6 (ccl::external-process-output-stream process
)))
7 (error (file-to-string-as-lines
8 (ccl::external-process-error-stream process
))))
9 (close (ccl::external-process-output-stream process
))
10 (close (ccl::external-process-error-stream process
))
13 (process-exit-code process
))))
15 (defun create-shell-process (command wait
&optional input
)
16 (with-input-from-string (input-stream input
)
18 *bourne-compatible-shell
*
20 :input input-stream
:output
:stream
:error
:stream
23 (defun process-alive-p (process)
24 (eq (nth-value 0 (ccl:external-process-status process
)) :running
))
26 (defun process-exit-code (process)
27 (nth-value 1 (ccl:external-process-status process
)))
29 (defun %os-process-id
()
30 (error 'unsupported-function-error
:function
'os-process-id
))
32 (defun %get-env-var
(name)