From: David B. <li...@da...> - 2008-03-09 18:33:12
|
Add the ELEMENT-TYPE argument to RUN-PROGRAM. This allows the caller to specify an element type for streams that are created when INPUT or OUTPUT are set to :stream. --- Clozure Common Lisp recently added this same argument to their run-program. It allows run-program to be used to speak with programs that have binary I/O. src/code/run-program.lisp | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/code/run-program.lisp b/src/code/run-program.lisp index 9a59ddb..d1c0130 100644 --- a/src/code/run-program.lisp +++ b/src/code/run-program.lisp @@ -592,7 +592,8 @@ status slot." (if-output-exists :error) (error :output) (if-error-exists :error) - status-hook) + status-hook + (element-type :default)) #+sb-doc #.(concatenate 'string @@ -675,7 +676,10 @@ Users Manual for details about the PROCESS structure."#-win32" same place as normal output. :STATUS-HOOK This is a function the system calls whenever the status of the - process changes. The function takes the process as an argument.") + process changes. The function takes the process as an argument. + :ELEMENT-TYPE + Set the stream element type that will be used when :OUTPUT or + :INPUT is set to STREAM.") #-win32 (when (and env-p environment-p) (error "can't specify :ENV and :ENVIRONMENT simultaneously")) @@ -750,16 +754,20 @@ Users Manual for details about the PROCESS structure."#-win32" :direction :input :if-does-not-exist if-input-does-not-exist :external-format :default + :element-type element-type :wait wait) (with-fd-and-stream-for ((stdout output-stream) :output output cookie :direction :output :if-exists if-output-exists + :element-type element-type :external-format :default) (with-fd-and-stream-for ((stderr error-stream) :error error cookie :direction :output :if-exists if-error-exists + ;; Assuming that stderr should + ;; always be character? :external-format :default) (with-open-pty ((pty-name pty-stream) (pty cookie)) ;; Make sure we are not notified about the child @@ -913,6 +921,7 @@ Users Manual for details about the PROCESS structure."#-win32" cookie &rest keys &key direction (external-format :default) wait + (element-type :default) &allow-other-keys) (declare (ignore wait)) ;This is explained below. ;; Our use of a temporary file dates back to very old CMUCLs, and @@ -960,7 +969,7 @@ Users Manual for details about the PROCESS structure."#-win32" (push read-fd *close-in-parent*) (push write-fd *close-on-error*) (let ((stream (sb-sys:make-fd-stream write-fd :output t - :element-type :default + :element-type element-type :external-format external-format))) (values read-fd stream))) @@ -968,7 +977,7 @@ Users Manual for details about the PROCESS structure."#-win32" (push read-fd *close-on-error*) (push write-fd *close-in-parent*) (let ((stream (sb-sys:make-fd-stream read-fd :input t - :element-type :default + :element-type element-type :external-format external-format))) (values write-fd stream))) -- 1.5.4.3 |