-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error-output cannot be retrieved from uiop's condition object #20
Comments
Simple example: (let ((s (make-string-output-stream)))
(handler-case (uiop:run-program "exit 1" :error-output s)
(uiop/run-program:subprocess-error (c) c)))
(inspect *) |
This works for me:
|
Of course. (in-package :supplier-package)
(defun foo (string)
(let ((s (make-string-output-stream)))
(cmd:$cmd "echo" string :error-output s)))
(in-package :client-package)
(defun some-user-function ()
(handler-case (supplier-package:foo "hello")
(uiop/run-program:subprocess-error (c)
;; print or resignal an error using stderr output here
))) |
I've pushed up a feature to allow overriding the null device for output and error output. E.g.:
I agree it would be better if when there was an error we got back an error object containing the stderr. I have to think more about how to do this in a way that (1) doesn't store unbounded amounts of error output, (2) works with launch-program's handling of error output (e.g. |
I have a branch up (https://github.com/ruricolist/cmd/tree/stderr-temporary) that partially handles this by storing error output in a temporary file if no stderr is specified. It doesn't "tee" the output yet though. |
I'm not sure if this is something that can be worked around in
cmd
, but it is not possible to get at the process-info of a condition being signalled with the synchronous uiop:run-program. My idea was that I could pass an:error-output
string/stream, and get at it when handling a condition, but by that point the process has already exited, and uiop has cleaned up its state.I guess uiop does something similar to
(run-program) (when error (cleanup) (signal)))
, so when the subprocess-error condition is signalled, itsprocess
slot is already nil.Is there any way to work around this? I really would like to get the stderr output in a condition handler.
The text was updated successfully, but these errors were encountered: