[Openmcl-devel] External process i/o weirdness?
Michael Klingbeil
michael at klingbeil.com
Tue May 13 22:32:37 PDT 2003
I'm having some trouble sending data to an external process created
via ccl:run-program. If I understand the documentation correctly if I
pass :stream as the input option, then I should be able to write to a
stream which will serve as the input feeding the external process.
However, whenever I try to write to this stream, I get errors. In
fact as I experiment further is sort of looks like the input and
output streams are double reversed -- the data structures for input
and output are reversed but the file descriptors are also reversed --
so nothing works! But there might be something I am totally missing.
I am using openmcl 0.13.5 under Darwin (MacOS X 10.2.4). I am
including a transcript of my experiments.
Michael
================================================================
;;; This works
(setf foo (ccl:run-program "cat" () :wait nil :input
(make-string-input-stream "hello") :output t))
;;; This is weird
(setf foo (ccl:run-program "cat" () :wait nil :input :stream :output :stream))
;;; results in an error
(write-string "hello" (ccl:external-process-input-stream foo))
#|
> Error: No applicable method for args:
> (#<FD-CHARACTER-INPUT-STREAM (NIL/4) #x566423E> "hello" 0 5)
> to #<STANDARD-GENERIC-FUNCTION CCL:STREAM-WRITE-STRING #x50967F6>
> While executing: #<CCL::STANDARD-KERNEL-METHOD NO-APPLICABLE-METHOD (T)>
|#
;;; no error but doesn't make sense, writes output to openmcl listener?
(write-string "hello" (ccl:external-process-output-stream foo))
;;; as expected
(streamp (ccl:external-process-input-stream foo)) ;; => T
;;; shouldn't the input stream be an output stream it is output from
openmcl to the external process?
(input-stream-p (ccl:external-process-input-stream foo)) ;; => T
(input-stream-p (ccl:external-process-output-stream foo)) ;; => NIL
(output-stream-p (ccl:external-process-input-stream foo)) ;; => NIL
(output-stream-p (ccl:external-process-output-stream foo)) ;; => T
;;; we can't read the external process output
(read-line (ccl:external-process-output-stream foo))
#|
> Error: No applicable method for args:
> (#<FD-CHARACTER-OUTPUT-STREAM (NIL/13) #x5664386>)
> to #<STANDARD-GENERIC-FUNCTION CCL:STREAM-READ-LINE #x5095E8E>
> While executing: #<CCL::STANDARD-KERNEL-METHOD NO-APPLICABLE-METHOD (T)>
|#
_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list