diff options
Diffstat (limited to 'waitress/server.py')
-rw-r--r-- | waitress/server.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/waitress/server.py b/waitress/server.py index 8d0ba68..ade7b46 100644 --- a/waitress/server.py +++ b/waitress/server.py @@ -157,23 +157,23 @@ class BaseWSGIServer(logging_dispatcher, object): self.channel_class(self, conn, addr, self.adj, map=self._map) def run(self): + exitcode = 0 try: self.asyncore.loop( timeout=self.adj.asyncore_loop_timeout, map=self._map, use_poll=self.adj.asyncore_use_poll, ) + except (asyncore.ExitNow, SystemExit): + exitcode = 0 except KeyboardInterrupt: - # note that this is the codepath that will be executed both during - # an actual ctrl-C of a foregrounded program, when any task code - # raises KeyboardInterrupt in a thread, or when any subthread of - # this process calls thread.interrupt_main() + # note that this is the codepath that will be executed when SIGINT + # is sent to the main thread, when an actual ctrl-C is pressed on + # the console, or when thread.interrupt_main() is called from a + # subthread exitcode = 1 - except (SystemExit, asyncore.ExitNow): - # note that this is the codepath that will be executed when SIGTERM - # is sent to the main thread + finally: self.task_dispatcher.shutdown() - exitcode = 0 return exitcode def pull_trigger(self): |