Hi there,

I'm busy trying to port some website code to work with ECL as well as
SBCL. To do so, I'm trying to write a function that will create a
process with a given string as standard input. On sbcl, I'd do the
following:

(with-input-from-string (s str)
  (sb-ext:run-program program args :input s))
and that works fine: the program runs, reading from the string and then
exits. After thinking for a bit, I came up with the following code to
try to get things working with ecl:

(let* ((p (nth-value 2
           (ext:run-program "/home/rupert/doit.sh" nil
                            :wait nil :error nil :output nil
                            :input :stream)))
       (in (si:external-process-input p)))
  (princ "blargl" in)
  (princ #\Newline in)
  (close in)
  p)
where /home/rupert/doit.sh contains the following:

#!/bin/bash

read x
echo $x >~/tmp.txt
This works, in that tmp.txt contains blargl after the code runs, but the
process never finishes:

rupert@hake:~ ps aux | grep doit
rupert   24764  0.0  0.0      0     0 ?        Z    01:12   0:00 [doit.sh] 
<defunct>
rupert   24771  0.0  0.0   5048   724 pts/0    S+   01:12   0:00 grep doit
How should I make sure that the process finishes too? (I don't mind if
I have to wait for it: this doesn't need to run in parallel)


Rupert

Attachment: pgpl5sjrQ4ddz.pgp
Description: PGP signature

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to