diff --git a/CHANGELOG.md b/CHANGELOG.md index 24b704c2b..60ca2bf52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased ### Fixed +- Terminate gracefully on SIGTERM - @recmo ## [0.3.1.0] - 2016-02-28 diff --git a/src/PostgREST/Main.hs b/src/PostgREST/Main.hs index f7a09fefc..68d3a12c1 100644 --- a/src/PostgREST/Main.hs +++ b/src/PostgREST/Main.hs @@ -60,10 +60,11 @@ main = do #ifndef mingw32_HOST_OS tid <- myThreadId - void $ installHandler keyboardSignal (Catch $ do - P.release pool - throwTo tid UserInterrupt - ) Nothing + forM_ [sigINT, sigTERM] $ \sig -> + void $ installHandler sig (Catch $ do + P.release pool + throwTo tid UserInterrupt + ) Nothing #endif result <- P.use pool $ do