4

Is there an easy way of making CherryPy perform an os._exit(0) once it gets a ^C interrupt?

It would normally wait for all the threads to terminate which is not useful for debugging as I expect it to shut down immediately.

zx81
  • 41,100
  • 9
  • 89
  • 105
Kristina
  • 15,859
  • 29
  • 111
  • 181

1 Answers1

5

See https://cherrypy.readthedocs.org/en/3.3.0/refman/process/plugins/signalhandler.html.

handlers = {'SIGTERM': self.bus.exit,
        'SIGHUP': self.handle_SIGHUP,
        'SIGUSR1': self.bus.graceful,
       }

are the default handlers; SIGINT from Ctrl-C isn't there (so I don't know if it's going the same as SIGTERM or what) but you could add it with whatever handler you want, including one that calls sys._exit.

Ryne Everett
  • 6,427
  • 3
  • 37
  • 49
agf
  • 171,228
  • 44
  • 289
  • 238