RUN-PROGRAM and error output
Elias Pipping
pipping.elias at icloud.com
Fri Sep 9 20:16:16 UTC 2016
> On 9 Sep 2016, at 20:35, Jason Miller <jason at milr.com> wrote:
>
> I did a bit more digging and found some interesting behavior on sbcl.
>
> Whether or not the output is propagated to a stream in the event of an
> error is dependant on shell vs. exec:
>
> (uiop:run-program "echo hi >&2; false" :error-output t) ; No output
> (uiop:run-program '("/bin/sh" "-c" "echo hi >&2; false" ) :error-output t) ; "hi\n" on *error-output*
>
> -Jason
Dear list (I’ve already talked to Jason in person on IRC so that he can savely ignore this e-mail),
the difference in behaviour seen here:
> (uiop:run-program "echo hi >&2; false" :error-output t) ; No output
> (uiop:run-program '("/bin/sh" "-c" "echo hi >&2; false" ) :error-output t) ; "hi\n" on *error-output*
boils down to the use of %run-program vs. %system as a result of the snippet
(when (stringp command)
(unless force-shell-suppliedp
#-(and sbcl os-windows) ;; force-shell t isn't working properly on windows as of sbcl 1.2.16
(setf force-shell t)))
in run-program.
What currently happens is that we have code of the form
(let (exit-code)
(with-program-output …
(setf exit-code (%check-result (%wait-process-result)))))
This means: If %check-result yields a condition, the with-program-output will not complete. But there’s no good reason for that. All %check-result needs is the exit-code and we keep that around anyway, so that we can just move %check-result out of the with-program-output block. This should not have any negative side effects I’m aware of and leave e.g. :error-output, if it’s a stream, in a deterministic state.
I’ve put up a merge request here:
https://gitlab.common-lisp.net/asdf/asdf/merge_requests/8
and would welcome comments.
Elias
PS: There are also a few other merge requests at https://gitlab.common-lisp.net/asdf/asdf/merge_requests
More information about the asdf-devel
mailing list