diff --git a/src/CHANGELOG b/src/CHANGELOG index 681089095..e85ef016f 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -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 diff --git a/src/c/unixsys.d b/src/c/unixsys.d index 77e36c268..d17240904 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -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,