[Ecls-list] RUN-PROCESS with input from string.
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Sun Feb 27 21:59:31 UTC 2011
On Sun, Feb 27, 2011 at 10:34 PM, Rupert Swarbrick <rswarbrick at gmail.com>wrote:
> Juan Jose Garcia-Ripoll
> <juanjose.garciaripoll at googlemail.com> writes:
> > On Sun, Feb 27, 2011 at 8:59 PM, Rupert Swarbrick <rswarbrick at gmail.com
> >wrote:
> >
> >>
> >> Hmm, I'm not sure it does actually :-( I've just compiled the latest
> >> code from git (0df960178922fb0dba752356e59d6194975f333e) and with the
> >> following definition:
> >>
> >
> > This is not the latest. Last two patches are shown below. It may take
> time
> > for changes to propagate.
> >
> > Juanjo
> >
> > $ git log -2
> > commit 0df960178922fb0dba752356e59d6194975f333e
> > Author: Juan Jose Garcia Ripoll <jjgarcia at users.sourceforge.net>
> > Date: Sun Feb 27 17:02:18 2011 +0100
> >
> > EXT:EXTERNAL-PROCESS-WAIT ignores -1 on Windows platforms.
> >
> ...
>
> Thank you very much for the reply, but isn't this the commit I've got?
Sorry for my temporary dyslexia, but did you rebuild from scratch? What
operating system are you using? I modified your test to look as I show below
and everything works fine. See the output on a Linux box, without zombies:
$ ecl -norc -load foo.lsp -eval '(quit)'
;;; Loading "/home/jjgarcia/build/ecl/foo.lsp"
Read line
test
21264 pts/0 S+ 0:00 ecl -norc -load foo.lsp -eval (quit)
21268 pts/0 S+ 0:00 sh -c ps awx|grep foo
21270 pts/0 S+ 0:00 grep foo
foo.lsp:
(with-open-file (s "foo.sh" :direction :output
:if-exists :supersede)
(format s "#~~/bin/sh
read x
echo Read line
echo $x
")
(ext:system "chmod +x foo.sh"))
(defun string>program (str program &rest args)
"Run program reading from STR as stdin."
#+sbcl
(with-input-from-string (s str)
(sb-ext:run-program program args :input s)
(values))
#+ecl
(let* ((p (nth-value 2
(ext:run-program program args
:wait nil :error nil :output t
:input :stream)))
(in (si:external-process-input p)))
(princ str in) (princ #\Newline in) (close in)
(values)))
(string>program "test" "./foo.sh")
(ext:system "ps awx|grep foo")
--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110227/7f9503b5/attachment.html>
More information about the ecl-devel
mailing list