Re: Who has tried run-process in STk-2.1.4 ?

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Mon, 14 Nov 1994 12:47:06 +0000

Here I can't say "hey, look the manual" ;-)

To make running the example you give you have to set the input and output of
your in a pipe (this was the meaning of #t if I remember in the original
implementation).

:input xxx where xxx is a string subsumes it is a file name
           where xxx = :pipe put it in a pipe.

the same thing apply to :output and :error

:wait admit a parametre which indicates id the jobs is run in background or
not
(defautl value for :wait is #f)

Hereafter is an example of run-process (output is not redirected)

        (define myprocess (run-process "cat" :input :pipe))
        #[undefined]
        STk> (process-input myprocess)
        #[output-port 'pipe-input-20565']
        STk> (write 122212 (process-input myprocess) )
        #[undefined]
        STk> (flush (process-input myprocess))
        122212#[undefined]


Following example use also an output redirection

        STk> (define myprocess2 (run-process "cat" :input :pipe :output :pipe))
        #[undefined]
        STk> (format (process-input myprocess2) "1\n2\n3\n")
        #[undefined]
        STk> (flush (process-input myprocess2))
        #[undefined]
        STk> (read (process-output myprocess2))
        1
        STk> (read (process-output myprocess2))
        2
        STk> (read (process-output myprocess2))
        3


Another thing which is not documented for now (and I don't remember if I have
already signaled it here) is that you can use pipe if you put a "|" as the
first
character of a file name. Hereafer are two examples of its usage:

(with-input-from-file "| ls -ls"
  (lambda ()
    (do ((l (read-line) (read-line)))
        ((eof-object? l))
      (display l)
      (newline))))


(with-output-to-file "| mail eg"
  (lambda()
    (format #t "This is a simple mail that I send to myself\n")))



  


                -- Erick

                -- Erick
Received on Mon Nov 14 1994 - 12:47:11 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST