harvesting external-process output in OpenMCL 0.13 broken
Gary Byers <[email protected]> Sat, 31 Aug 2002 00:19:58 -0600 (MDT)
| Newsgroups | gmane.lisp.openmcl.bugs |
|---|---|
| Message-ID | <[email protected]> |
Beginning with OpenMCL 0.13, a lisp process (the value of
CCL::*EXTERNAL-PROCESS-WATCHDOG*) is supposed to watch for the termination
status of external processes (created via #'RUN-PROGRAM) and to handle
redirected I/O to and from those external processes.
The lisp watchdog process is supposed to only be active (considered by
the scheduler) when it "has something to do"; in 0.13, it deactivates
itself prematurely in some cases. This in turn can cause RUN-PROGRAM
to wait indefinitely for pending output; the example from the "run-program"
documentation page:
(with-output-to-string (stream)
(run-program "uname" '("-r") :output stream))
will often hang as a result.
Interrupting it via ^C, calling
1> (ccl::watch-file-descriptors)
and
1> (continue)
in the break loop will "harvest" the pending output and allow the
call to RUN-PROGRAM to return.
The enclosed patch should cause the watchdog process to remain active
as long as it has some work to do.
watchdog-reset.diff
(text/plain, 798 B)
Index: level-1/l1-boot-3.lisp =================================================================== RCS file: /usr/local/publiccvs/ccl/level-1/l1-boot-3.lisp,v retrieving revision 1.3 diff -u -r1.3 l1-boot-3.lisp --- level-1/l1-boot-3.lisp 7 Aug 2002 07:46:44 -0000 1.3 +++ level-1/l1-boot-3.lisp 31 Aug 2002 05:34:40 -0000 @@ -26,12 +26,10 @@ (process-preset *external-process-watchdog* #'(lambda () (loop - (process-wait "external-process" - #'(lambda () - (not (null *external-processes*)))) (watch-file-descriptors) (check-all-pids) - (when (null *external-processes*) + (when (and (null *external-processes*) + (null *watched-fd-handlers*)) (process-enable-arrest-reason *current-process*)))))) (catch :toplevel