[Openmcl-devel] Handling SIGTERM in applications

Max Rottenkolber max at mr.gy
Tue Oct 25 18:59:50 PDT 2016


On Wed, 26 Oct 2016 01:09:28 +0000, Max Rottenkolber wrote:

> D'oh. I meant SIGINT. SIGTERM works just fine. To reprodcuce:
> 
> (save-application
>  "sigint-test"
>  :toplevel-function (lambda () (loop do (sleep 1)))
>  :error-handler :quit
>  :purify t
>  :prepend-kernel t)
> 
> $ ./sigint-test # send it SIGINT
>   C-c C-c> Break: interrupt signal
>> While executing: CCL::%NANOSLEEP, in process toplevel(2).
>> Type :GO to continue, :POP to abort, :R for a list of available restarts.
>> If continued: Return from BREAK.
>> Type :? for other options.
> 1 >
> 
> (Note that there is no actual break loop, it just prints the above and gets
> stuck, ignoring input, or a subsequent SIGINT.)

I was able to work around this by setting two internal special variables:

  (setf ccl::*invoke-debugger-hook-on-interrupt* t)
  (setf ccl::*debugger-hook*
      (lambda (condition hook)
        (declare (ignore hook))
        (etypecase condition
          (ccl::interrupt-signal-condition (quit 130)))))





More information about the Openmcl-devel mailing list