-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
launcher: When terminated, ensure child processes are cleaned up
- Loading branch information
Showing
5 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- | | ||
-- Copyright: © 2018-2019 IOHK | ||
-- License: MIT | ||
-- Portability: POSIX | ||
-- | ||
|
||
module Cardano.Launcher.POSIX | ||
( installSignalHandlers | ||
) where | ||
|
||
import Prelude | ||
|
||
import Control.Monad | ||
( void ) | ||
import Say | ||
( sayErr ) | ||
import System.Posix.Signals | ||
( Handler (..) | ||
, installHandler | ||
, keyboardSignal | ||
, raiseSignal | ||
, softwareTermination | ||
) | ||
|
||
-- | Convert any SIGTERM received to SIGINT, for which the runtime system has | ||
-- handlers that will correctly clean up sub-processes. | ||
installSignalHandlers :: IO () | ||
installSignalHandlers = void $ | ||
installHandler softwareTermination termHandler Nothing | ||
where | ||
termHandler = CatchOnce $ do | ||
sayErr "Terminated by signal." | ||
raiseSignal keyboardSignal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- | | ||
-- Copyright: © 2018-2019 IOHK | ||
-- License: MIT | ||
-- Portability: Windows | ||
-- | ||
|
||
module Cardano.Launcher.Windows | ||
( installSignalHandlers | ||
) where | ||
|
||
import Prelude | ||
|
||
-- | Stub function for windows. | ||
installSignalHandlers :: IO () | ||
installSignalHandlers = pure () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters