chickadee » pty » call-with-pty-process-io

call-with-pty-process-io command proc #!optional name width heightprocedure

Call and return the result of proc which should be a procedure of three arguments: the input, output and PID of the sub-process command running in a new PTY. Ensures the sub-process is terminated on completion.

name, width and height are optional settings for the new PTY.

command may optionally be a list specifying the arglist to the sub-process, or a single string which is split on whitespace.

The ports generated only block the current thread, and char-ready? only returns #t if some input is already available. The eof-object is returned only when the sub-process terminates.

NOTE: Prior to login of, and after completion of the sub-process, anything written to the output port will pass directly through to the input port, which is almost certainly not what you want. To avoid premature writes, you should read once first. To avoid writing after the process has completed, don't write after you've read a single eof-object, or alternately you can check manually with process-alive?.