[Ecls-list] RUN-PROCESS with input from string.

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Feb 27 22:16:17 UTC 2011


Can you try the patch below? Seems this change did not get committed -- I am
surprised, though, why things seemed to work suddenly here.

Juanjo

diff --git a/src/c/main.d b/src/c/main.d
index 6d0df25..e56d29d 100644
--- a/src/c/main.d
+++ b/src/c/main.d
@@ -72,7 +72,7 @@ static cl_fixnum option_values[ECL_OPT_LIMIT+1] = {
  1, /* ECL_OPT_TRAP_SIGILL */
  1, /* ECL_OPT_TRAP_SIGBUS */
  1, /* ECL_OPT_TRAP_SIGPIPE */
- 0, /* ECL_OPT_TRAP_SIGCHLD */
+ 1, /* ECL_OPT_TRAP_SIGCHLD */
  1, /* ECL_OPT_TRAP_INTERRUPT_SIGNAL */
  1, /* ECL_OPT_SIGNAL_HANDLING_THREAD */
  128, /* ECL_OPT_SIGNAL_QUEUE_SIZE */


On Sun, Feb 27, 2011 at 10:59 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:

>
>
> 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
>



-- 
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/655711ca/attachment.html>


More information about the ecl-devel mailing list