<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">Hi folks,</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">I'm receiving the following error message when I attempt to use the procedure</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">(pipe-content-length pipe-port), from two threads which have been launched</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">to handle the i/o from bash launched with the procedure `subprocess' on an</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">OS X box.</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">At first I wasn't using the pipe-content-length procedure to inquire about the</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">port.   It was after isolating a problem I'm having, in the code below, where the</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">two threads were both blocking on a `read-char', instead of returning eof as they</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">should if there are no characters waiting to be read.  Since the two ports are</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">produced by the `subprocess' procedure, the doc indicates that they are each attached</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">to a pipe connected to stdout and stderr of the bash shell.  So, I did a search on pipe</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">in the help desk, and came up with `pipe-content-length' as a possible means of </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">diagnosing the problem.  Now that I'm getting an error regarding the type of port</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">being called into question, I thought I would see if anyone has dealt with the ports</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">returned from `subprocess', and wether I should be using something other than the</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">standard `read-char' to access them?</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>------------------------------------------------------------------------------------</DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">Welcome to DrScheme, version 369.100-svn13may2007 [3m].</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">Language: SchemeKeys.</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" color="#FF0262"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">. pipe-content-length: expects argument of type &lt;pipe input port or output port&gt;; given #&lt;input-port:subprocess-stderr&gt;</SPAN></FONT></FONT></DIV><DIV><SPAN class="Apple-style-span"><FONT class="Apple-style-span" color="#FF0262"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">. pipe-content-length: expects argument of type &lt;pipe input port or output port&gt;; given #&lt;input-port:subprocess-stdout&gt;</SPAN></FONT></FONT></SPAN></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">bash for DrScheme is  running: pop-status #f pep-status #f </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">bash: "sending bash `exit'" </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">"waiting for bash to terminate" </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">"killing bash!" </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">"bash has terminated with exit code= " -1 </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">"bash has terminated" </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">"terminating threads" </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">eof</SPAN></FONT></DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">------------------------------------------------------------------------------------</SPAN></FONT><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">I've included the code below if it will help.  Sorry, it's rather long.</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">Thanks,</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><BR></SPAN></FONT><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Arial; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Arial; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">--kyle</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">Kyle Smith</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">kyle at bellsouth dot net</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">schemekeys.blogspot.com</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">www.schemekeys.net</SPAN></FONT></DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">------------------------------------------------------------------------------------</SPAN></FONT><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">(module bash.ss mzscheme</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (provide (all-defined))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define (dp . x)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">    (for-each (λ(n)(printf "~s " n)) x)(newline))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define (da . x)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">    (for-each (λ(n)(printf "~a " n)) x)(newline))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define bash-path (string-&gt;path "/bin/bash"))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define sleep-interval 5)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define (bash-prompt) (display "bash: "))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define ill-formatted-cmd-msg</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">    "Commands must be a single string, within a list!  Recieved:")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  (define (go)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">    (let-values ([(pid pop pip pep) (subprocess #f #f #f bash-path "-ls")])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">      (if (not (and (input-port? pop) (input-port? pep) (output-port? pip)))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">          (begin</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            (dp "bad ports?")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            (subprocess-kill pid #t))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">          (let ([pop-thread-id</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                 (thread</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                  (λ()</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    (da "stdout thread is up: "</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        'input-port? (input-port? pop)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        'pipe-content-length (pipe-content-length pop))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    (let loop ([ch (read-char pop)])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (if (not (eof-object? ch))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (display ch))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (let wait ([ready? (char-ready? pop)][tic 0])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        (when (and (not ready?) (= tic 150))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (da "stdout thread is waiting: " ready?)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (set! tic 0))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        (unless ready?</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (sleep 0.1)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (wait (char-ready? pop) (add1 tic))))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (loop (read-char pop)))))]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                [pep-thread-id</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                 (thread</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                  (λ()</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    (da "stderr thread is up"</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        'input-port? (input-port? pep)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        'pipe-content-length (pipe-content-length pep))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    (let loop ([ch (read-char pep)])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (if (not (eof-object? ch))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (display ch))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (let wait ([ready? (char-ready? pep)][tic 0])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        (when (and  (not ready?) (= tic 150))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (da "stderr thread is waiting: " ready?)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (set! tic 0))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                        (unless ready?</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (sleep 0.1)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (wait (char-ready? pep) (add1 tic))))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (loop (read-char pep)))))])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            (define (bash-status pid)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">              (let ([status (subprocess-status pid)]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    [pop-status (thread-running? pop-thread-id)]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                    [pep-status (thread-running? pep-thread-id)])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                (cond</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                  [(eq? status 'running) </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (format "~a: ~a ~a ~a ~a"</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                             'running</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                             'pop-status</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                             pop-status</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                             'pep-status</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                             pep-status)]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                  [else</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (dp "bash has terminated with exit code= " status)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   #f])))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            (sleep 1)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">            (if (not (subprocess? pid))  ;;; isa? is rather a long procedure</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                                         ;;; so I comment it out below.</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                (dp "subprocess returned an invalid pid: " pid #;(isa? pid))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                (dynamic-wind</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                 (λ() (da "bash for DrScheme is " (bash-status pid)))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                 (λ()</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (let/ec break</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                     (if (not (bash-status pid)) (break 'bash-is-down))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                     (bash-prompt)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                     (let loop ([cmd (read)])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                       (cond</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                         [(eof-object? cmd) (break 'eof)]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                         [(not (list? cmd))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (dp ill-formatted-cmd-msg cmd)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (bash-prompt)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (loop (read))]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                         [(and (= (length cmd) 2)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                               (eqv? (car cmd) 'sleep))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (set! sleep-interval (cadr cmd))]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                         [(and (= (length cmd) 1)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                               (string? (car cmd)))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          ;;; Send cmd onto bash</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (dp 'cmd-sent-to-bash: (car cmd))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (display (car cmd) pip)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (display (newline) pip)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (sleep sleep-interval)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (if (not (bash-status pid)) (break 'bash-is-down))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (bash-prompt)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (loop (read))]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                         [else </SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (dp ill-formatted-cmd-msg cmd)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (bash-prompt)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (loop (read))]))))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                 (λ()</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (cond</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                     [(not (bash-status pid))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (dp "bash had terminated early!")]</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                     [else</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (dp "sending bash `exit'")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (display "exit\n" pip)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (dp "waiting for bash to terminate")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (sleep 3)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (if (bash-status pid)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (begin</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                            (dp "killing bash!")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                            (subprocess-kill pid #t)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                            (sleep 3)))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                      (if (bash-status pid)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (dp "bash shell will not terminate, process-id= "</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                              (subprocess-pid pid))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                          (dp "bash has terminated"))])</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (dp "terminating threads")</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (kill-thread pop-thread-id)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   (kill-thread pep-thread-id)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">                   ))))))</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">    )</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">  )</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">#|</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">&lt;test-suite&gt;</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">|#</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">(require bash.ss)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">(go)</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">#|</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">&lt;/test-suite&gt;</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR></DIV></BODY></HTML>