Commit 5f8d2af9 authored by Elias Pipping's avatar Elias Pipping
Browse files

MKCL: Translate signal code

This will not work on MKCL 1.1.9 and earlier
parent 722590f7
......@@ -414,6 +414,11 @@ argument to pass to the internal RUN-PROGRAM"
(integer raw-exit-code) ; negative: signal
(t -1)))
#+mkcl
(defun %mkcl-signal-to-number (signal)
  • I would not use mkcl- in the name of this function.

  • But it's mkcl-specific. And that's unlikely to change in the future.

  • But the clisp function isn't called clisp-* -- although my clisp-exit-code does have clisp. As you wish.

  • Yes, clisp-exit-code is what prompted me to consider that prefix.

    It's worth noting that allegro cl, clozure cl, cmu cl, ecl, and sbcl do also provide native ways to turn signal names into numbers (I have a piece of code lying around for that; allegro cl still lacks sigcont, but they're aware of that).

    Other platforms don't. And I'm not sure if something like the cffi-based trivial-signal isn't a better place for such logic.

    Edited by Elias Pipping
Please register or sign in to reply
(require :mk-unix)
(symbol-value (find-symbol signal :mk-unix)))
(defclass process-info ()
((process :initform nil)
(input-stream :initform nil)
......@@ -576,7 +581,11 @@ It returns a process-info object."
((zerop mode))
((null process*) (prop 'exit-code -1))
(t (prop (case mode (1 'input-stream) (2 'output-stream) (3 'bidir-stream)) stream))))
(when code (prop 'exit-code code))
(when code (prop 'exit-code
#-mkcl code
#+mkcl (if (stringp code)
(%mkcl-signal-to-number code)
code)))
(when process (prop 'process process)))
#+lispworks
(if wait
......@@ -653,7 +662,10 @@ might otherwise be irrevocably lost."
#-lispworks7+ #'sys:pid-exit-status
process :wait t)
(or signal exit-code))
#+mkcl (mkcl:join-process process)
#+mkcl (let ((exit-code (mkcl:join-process process)))
(if (stringp exit-code)
(%mkcl-signal-to-number exit-code)
(exit-code)))
#+sbcl (sb-ext:process-exit-code process)))
(setf (slot-value process-info 'exit-code) exit-code)
exit-code)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment