run-program: add hack for installing signal-handler

This commit is contained in:
Daniel Kochmański 2017-02-19 18:25:03 +01:00
parent a92c50fe44
commit d6b0354772
3 changed files with 13 additions and 4 deletions

View file

@ -1972,6 +1972,8 @@ cl_symbols[] = {
{KEY_ "ENVIRON", KEYWORD, NULL, -1, OBJNULL},
/* external-process extension */
{EXT_ "RUN-PROGRAM", EXT_ORDINARY, ECL_NAME(si_run_program), -1, OBJNULL},
{EXT_ "MAKE-EXTERNAL-PROCESS", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "EXTERNAL-PROCESS", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "EXTERNAL-PROCESS-PID", EXT_ORDINARY, NULL, -1, OBJNULL},
@ -1981,7 +1983,6 @@ cl_symbols[] = {
{EXT_ "EXTERNAL-PROCESS-STATUS", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "EXTERNAL-PROCESS-WAIT", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "TERMINATE-PROCESS", EXT_ORDINARY, ECL_NAME(si_terminate_process), -1, OBJNULL},
{EXT_ "RUN-PROGRAM", EXT_ORDINARY, ECL_NAME(si_run_program), -1, OBJNULL},
{KEY_ "RUNNING", KEYWORD, NULL, -1, OBJNULL},
{KEY_ "EXITED", KEYWORD, NULL, -1, OBJNULL},

View file

@ -1972,6 +1972,8 @@ cl_symbols[] = {
{KEY_ "ENVIRON",NULL},
/* external-process extension */
{EXT_ "RUN-PROGRAM","ECL_NAME(si_run_program)"},
{EXT_ "MAKE-EXTERNAL-PROCESS",NULL},
{EXT_ "EXTERNAL-PROCESS",NULL},
{EXT_ "EXTERNAL-PROCESS-PID",NULL},
@ -1981,7 +1983,6 @@ cl_symbols[] = {
{EXT_ "EXTERNAL-PROCESS-STATUS",NULL},
{EXT_ "EXTERNAL-PROCESS-WAIT",NULL},
{EXT_ "TERMINATE-PROCESS","ECL_NAME(si_terminate_process)"},
{EXT_ "RUN-PROGRAM","ECL_NAME(si_run_program)"},
{KEY_ "RUNNING",NULL},
{KEY_ "EXITED",NULL},

View file

@ -33,8 +33,6 @@
(let ((hook (external-process-status-hook proc)))
(when hook (funcall hook proc))))))
;; (ext:set-signal-handler ext:+sigchld+ #'sigchld-handler)
(defstruct (external-process (:constructor make-external-process ()))
@ -125,6 +123,15 @@
(external-format :default)
#+windows (escape-arguments t))
;; XXX: we should install handler during loading of external-process
;; module. Problem lies in fact, that handlers can't be installed
;; before cl_boot finishes, so this form can't be top level in case
;; when moudle is built-in. Good solution to that problem would be
;; providing hook mechanism for functions to call after cl_boot.
;; This way many modules may be easily untied from the core.
(unless (ext:get-signal-handler ext:+sigchld+)
(ext:set-signal-handler ext:+sigchld+ #'sigchld-handler))
(flet ((process-stream (which default &rest args)
(cond ((eql which t) default)
((or (stringp which) (pathnamep which))