diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-11-02 22:19:39 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-11-03 08:10:30 +0100 |
commit | 0ae2e7f73c24779f8c99453fb02491382cc0520e (patch) | |
tree | f7bd68672746107c5bcc91686fef48c0f5c11bf2 /server.js | |
parent | 3a443402a6f22e4ac1fd80af62abfef7efd6d7a4 (diff) | |
download | PeerTube-0ae2e7f73c24779f8c99453fb02491382cc0520e.tar.gz PeerTube-0ae2e7f73c24779f8c99453fb02491382cc0520e.tar.zst PeerTube-0ae2e7f73c24779f8c99453fb02491382cc0520e.zip |
add robustness when we run the electron process and move the exit
controller inside the main js file
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -150,6 +150,18 @@ | |||
150 | if (err) throw err | 150 | if (err) throw err |
151 | // Create/activate the webtorrent module | 151 | // Create/activate the webtorrent module |
152 | webtorrent.create(function () { | 152 | webtorrent.create(function () { |
153 | function cleanForExit () { | ||
154 | utils.cleanForExit(webtorrent.app) | ||
155 | } | ||
156 | |||
157 | function exitGracefullyOnSignal () { | ||
158 | process.exit() | ||
159 | } | ||
160 | |||
161 | process.on('exit', cleanForExit) | ||
162 | process.on('SIGINT', exitGracefullyOnSignal) | ||
163 | process.on('SIGTERM', exitGracefullyOnSignal) | ||
164 | |||
153 | // ----------- Make the server listening ----------- | 165 | // ----------- Make the server listening ----------- |
154 | server.listen(port, function () { | 166 | server.listen(port, function () { |
155 | videos.seedAll(function () { | 167 | videos.seedAll(function () { |