[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Barak Bar Oryon
Tue, 30 Jan 2001 09:50:09 +0200 (IST)
I have tried to use the expect module for chatting
with an ftp process but I didn't get too far (:
I couldn't get the ftp output to the expect script.
When I tried it with another guile function it worked fine.
1) Does it related to buffering in the ftp client.
2) How can I make it work ...
;; -*- scheme -*-
(use-modules (ice-9 expect))
(let ((pipe1 (pipe))
(setvbuf (car pipe1) _IONBF)
(setvbuf (cdr pipe1) _IONBF)
(setvbuf (car pipe2) _IONBF)
(setvbuf (cdr pipe2) _IONBF)
(let ((pid (primitive-fork)))
(if (zero? pid)
;; I'm the child
(with-input-from-port (car pipe2)
(with-output-to-port (cdr pipe1) command-thunk)))
;; I'm still me :)
(begin (expect-thunk (cdr pipe2) (car pipe1) pid)
(lambda(out in pid)
(let ((expect-port in)
(display (string-append "Times up! " s "\n"))
(kill pid SIGKILL)
(lambda (s) (display "Reached tfdes (current-output-port)
(expect-thunks me proc)