[plt-scheme] reading the output of a shell command execution

From: Pedro Kroger (kroegerlistas at pedrokroeger.net)
Date: Tue Feb 8 10:31:46 EST 2005


I'm running a shell program using "process/ports" and trying to read
it's output using a string port "port". If I type the body of the
following function in the REPL I get some results (e.g. "No changes!\n")
but if I put the code in a function "foo" it returns "".

(define (foo)
  (define port (open-output-string))
  (current-directory "bib")
  (process/ports port #f #f "darcs whatsnew")
  (current-directory "/home/kroger")
  (get-output-string port))

I'm pretty new to scheme and would appreciate any advice.


Pedro Kroger

Posted on the users mailing list.