I'm having trouble with two interacting processes and am hoping someone can 
point out whatever it is that I'm missing.  

Process A starts process B and interacts with it but conditionally needs to 
kill it.  But using the procedure of one argument returned (as the fifth 
element of a list) by process does not seem to kill it.  I've tried "kill -9 
<pid>" with system with no joy either.  Here is my code and the output from 
killer.
=======================
;code for sleeper in a separate file
(define (sleeper)
  (for ([i 7])
    (sleep 4)
    (printf "~a~%" i)(flush-output)))
(sleeper)
=======================
;code for killer in another file -- I run this as "racket killer.rkt"
(define (killer)
  (let ([pl (process "racket sleeper.rkt")])
    (for ([l (in-port read-line (first pl))])
      (printf "status: ~a~%" ((fifth pl) 'status))
      (if (= (with-input-from-string l read) 2)
          (begin
            ;(system (string-append "kill -9 " (number->string (third pl))))
            ((fifth pl) 'kill)
            )
          (displayln l)))
    (close-input-port (first pl))
    (close-output-port (second pl))
    (close-input-port (fourth pl))
    ))
(killer)
=======================
;; output from killer
status: running
status: running
0
status: running
1
status: running
status: done-error
3
status: done-error
4
status: done-error
5
status: done-error
6
=======================

So what am I missing?  Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to