Christophe Rhodes writes:
> Friedrich Dominicus <frido@...> writes:
>
> > /bin/cat: /tmp/t1.txt | /bin/grep eins: No such file or directory
> >
> > what am I doing wrong?
>
> RUN-PROGRAM is a wrapper around fork()/exec(); it does not touch the
> shell. The pipe character | is a shell feature which arranges for a
> pipe to connect the output of one process to the input of the other.
>
> > What I want in the end is that I run an external program, maybe in a
> > piple which should give me a stream from which I can read. How am I
> > supposed to do that in SBCL?
>
> Construct your pipes, either using SB-POSIX or by running two programs
> with run-program and connecting the streams up yourself (but beware:
> possible deadlocks lurk).
Or by constructing a valid shell pipeline, and call it via "sh
-c".
Example:
(with-open-file (stream "test.out" :direction :output
:if-does-not-exist :create :if-exists :supersede)
(sb-ext:run-program "/bin/sh" (list "-c"
"/bin/cat /tmp/t1.txt | /usr/bin/grep eins")
:input t :output stream :wait nil))
--
Raymond Wiker Mail: Raymond.Wiker@...
Senior Software Engineer Web: http://www.fast.no/
Fast Search & Transfer ASA Phone: +47 23 01 11 60
P.O. Box 1677 Vika Fax: +47 35 54 87 99
NO-0120 Oslo, NORWAY Mob: +47 48 01 11 60
|