RUN-PROGRAM and error output

Jason Miller jason at milr.com
Fri Sep 9 18:35:02 UTC 2016


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

On 10:44 Fri 09 Sep     , Jason Miller wrote:
> Hi,
> 
> A lot of times the most useful information when an external program
> returns an error is the stderr output.  However, I can't figure out any
> way to get this without setting :ignore-error-status to T.
> 
> In particular I feel things would be strictly better if every invocation
> of the form:
> 
>   (run-program ... :error-output t)
>   
> Acted more like:
> 
>   (let ((result (multiple-value-list (run-program
>                                        :error-output t
>                                        :ignore-error-status t))))
>     (when (not (zerop (caddr result))) (cerror ...))
>     (values-list result))
> 
> The former prints no output to *error-output* in the event of non-zero
> return, but the latter prints all the output.
> 
> There may be a better way of doing this (including the error file or
> output in the condition object perhaps?), so I'm open to alternatives.
> Any thoughts?
> 
> -Jason
> 



More information about the asdf-devel mailing list