diff options
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/runners/rest.py | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index b83c0186a..4a9e725bf 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -53,6 +53,8 @@ Testing ------- * New configuration variable in [devmode] section, called `wait` which sets the timeout value used in the test suite for starting up subprocesses. + * Handle SIGTERM in the REST server so that the test suite always shuts down + correctly. (LP: #770328) 3.0 alpha 7 -- "Mission" diff --git a/src/mailman/runners/rest.py b/src/mailman/runners/rest.py index 1e631c6a3..cc55001c7 100644 --- a/src/mailman/runners/rest.py +++ b/src/mailman/runners/rest.py @@ -44,15 +44,20 @@ class RESTRunner(Runner): def run(self): log.info('Starting REST server') + # Handle SIGTERM the same way as SIGINT. + def stop_server(signum, frame): + log.info('REST server shutdown') + sys.exit(signal.SIGTERM) + signal.signal(signal.SIGTERM, stop_server) try: make_server().serve_forever() except KeyboardInterrupt: log.info('REST server interrupted') - sys.exit(signal.SIGTERM) + sys.exit(signal.SIGINT) except select.error as (errcode, message): if errcode == errno.EINTR: log.info('REST server exiting') - sys.exit(signal.SIGTERM) + sys.exit(errno.EINTR) raise except: raise |
