[Ecls-list] RUN-PROCESS with input from string.
Rupert Swarbrick
rswarbrick at gmail.com
Sun Feb 27 19:59:00 UTC 2011
Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> writes:
> On Sun, Feb 27, 2011 at 5:04 PM, Juan Jose Garcia-Ripoll <
> juanjose.garciaripoll at googlemail.com> wrote:
>
>> Actually it should have worked, but for some reason it does not. I have
>> tried various things and as a last resort I had to introduce a signal
>> handler for SIGCHLD that updates a new list of external (and active)
>> processes.
>>
>
> Just in case it was not obvious, this means that the code in Rupert's email
> now seems to work with ECL on POSIX (Linux, *BSD, OS X)
>
> Juanjo
Hmm, I'm not sure it does actually :-( I've just compiled the latest
code from git (0df960178922fb0dba752356e59d6194975f333e) and with the
following definition:
(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 nil
:input :stream)))
(in (si:external-process-input p)))
(princ str in) (princ #\Newline in) (close in)
(values)))
when I run
(string>program "test" "/home/rupert/doit.sh")
where doit.sh has the contents:
#!/bin/bash
read x
echo $x >~/tmp.txt
I still get the right stuff in tmp.txt but 'ps aux | grep doit' gives
me:
rupert at hake:~ ps aux | grep doit
rupert 16120 0.0 0.0 0 0 ? Z 19:54 0:00 [doit.sh] <defunct>
rupert 16263 0.0 0.0 0 0 ? Z 19:54 0:00 [doit.sh] <defunct>
rupert 16266 0.0 0.0 5048 724 pts/0 S+ 19:54 0:00 grep doit
(this is after running the function twice).
Am I doing something wrong?
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110227/8365a1b6/attachment.sig>
More information about the ecl-devel
mailing list