-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support to
process
for operating system signals (#209)
* Patching event-loop to latest version * Adding signals binding * Adding support for OS signal listeners * Adding signals JS example * Refactoring * Linking event-loop as a separate crate * Refactoring * Fixing clippy warnings * Fixing compilation issues on Windows
- Loading branch information
Showing
18 changed files
with
365 additions
and
1,284 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
import http from 'http'; | ||
|
||
// We need somehow to keep the event-loop alive. | ||
http.createServer(() => {}).listen(3000); | ||
|
||
let shouldExit = false; | ||
|
||
// Exit on fast double CTRL+C key press. | ||
const onSignal = () => { | ||
if (shouldExit) process.exit(0); | ||
shouldExit = true; | ||
setTimeout(() => { | ||
shouldExit = false; | ||
}, 500); | ||
}; | ||
|
||
process.on('SIGINT', onSignal); |
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
Oops, something went wrong.