>>>>> "dk" == Damien Kick <······@email.mot.com> writes:
dk> (let ((process (run-program "uname" nil :wait nil :pty t)))
dk> Error in function COMMON-LISP::DO-INPUT:
dk> Error reading #<Stream for descriptor 12>: I/O error
in order to use the :pty option to RUN-PROGRAM, you should also
specify the options
:input t :output t :error t
The reason for this is somewhat obscure: the default values for these
options mean that a descriptor is allocated from /dev/null, which ends
up squashing (via dup2) the descriptor for the slave side of the tty
in the child, which means that you get an EIO when attempting to read
from the parent.
The defaults should really be set more intelligently in this case.
--
Eric Marsden <URL:http://www.laas.fr/~emarsden/>
Eric Marsden <········@laas.fr> writes:
> >>>>> "dk" == Damien Kick <······@email.mot.com> writes:
>
> dk> (let ((process (run-program "uname" nil :wait nil :pty t)))
>
> dk> Error in function COMMON-LISP::DO-INPUT:
> dk> Error reading #<Stream for descriptor 12>: I/O error
>
> in order to use the :pty option to RUN-PROGRAM, you should also
> specify the options
>
> :input t :output t :error t
Thank you very much. FWIW, now I have an ILISP question/problem <grin
type="sheepish">. Everything works just great if I run things from
the UNIX shell.
[····@csdndev08 ~/tmp]% cmucl
CMU Common Lisp 18e, running on csdndev08
With core: /usr/test/awo/user_work/kick/sparc-sun-solaris2.6/lib/cmucl/lib/lisp.core
Dumped on: Tue, 2003-04-08 13:23:10-05:00 on achat
See <http://www.cons.org/cmucl/> for support information.
Loaded subsystems:
Python 1.1, target SPARCstation/Solaris 2
CLOS 18e (based on PCL September 16 92 PCL (f))
* (let ((process (ext:run-program "uname" nil :wait nil :pty t
:input t :output t :error t)))
(unwind-protect
(let ((stream (ext:process-pty process)))
(format t "Before attempting to read-char ")
(force-output)
(format t "(read-char stream) => ~A~%"
(read-char stream)))
(progn
(format t "(process-status process) => ~A~%"
(ext:process-status process))
(format t "(process-exit-code process) => ~A~%"
(ext:process-exit-code process))
(format t "(process-close process) => ~A~%"
(ext:process-close process)))))
Before attempting to read-char (read-char stream) => S
(process-status process) => RUNNING
(process-exit-code process) => NIL
(process-close process) => #<process 20369 :EXITED>
NIL
*
However, if I try the same thing within an ILISP buffer, I have
problems.
;; ilisp-*version* => 5.12.0
*
(let ((process (ext:run-program "uname" nil :wait nil :pty t
:input t :output t :error t)))
#| ... |#)
Before attempting to read-char (read-char stream) => S
(process-status process) => RUNNING
(process-exit-code process) => NIL
;; At this point, the *cmulisp* buffer process has died...
I don't have the same problem without the :PTY keyword, though...
* (let ((process (ext:run-program "uname" nil :wait nil :output t)))
(unwind-protect
nil
(let ((status (ext:process-status process)))
(format t "status => ~A~%" status)
(unless (eql status :running)
(format t "(process-exit-code process) => ~A~%"
(ext:process-exit-code process)))
(format t "(process-close process) => ~A~%"
(ext:process-close process)))))
status => RUNNING
(process-close process) => #<process 20580 :RUNNING>
NIL
* SunOS
;; Everything is still happy...
I haven't found any mention of RUN-PROGRAM in the ILISP bug tracker
<http://sourceforge.net/tracker/?group_id=3957&atid=103957> or mailing
lists <http://sourceforge.net/mail/?group_id=3957> but we'll see what
they have to say about it.