Make EXT:RUN-PROCESS synchronous

This commit is contained in:
jgarcia 2007-11-24 15:38:24 +00:00
parent ac0e263ce9
commit da525a7b36
2 changed files with 11 additions and 1 deletions

View file

@ -172,6 +172,10 @@ ECL 1.0:
- There was no builtin type for loaded libraries.
- EXT:RUN-PROGRAM has now a keyword argument :WAIT, which defaults to T and
which determines whether the function should wait for the process to finish
before returning.
* Unicode:
- MAKE-STRING only allowed :ELEMENT-TYPE to be one of CHARACTER, BASE-CHAR, or

View file

@ -89,7 +89,7 @@ si_close_pipe(cl_object stream)
}
@(defun ext::run-program (command argv &key (input @':stream') (output @':stream')
(error @'t'))
(error @'t') (wait @'t'))
int parent_write = 0, parent_read = 0;
int child_pid;
cl_object stream_write;
@ -347,6 +347,12 @@ si_close_pipe(cl_object stream)
parent_write = 0;
parent_read = 0;
FEerror("Could not spawn subprocess to run ~S.", 1, command);
} else if (wait != Cnil) {
#if defined(mingw32) || defined (_MSC_VER)
#else
int status[0];
waitpid(child_pid, status, 0);
#endif
}
if (parent_write > 0) {
stream_write = ecl_make_stream_from_fd(command, parent_write,