aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-11-02 22:19:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2015-11-03 08:10:30 +0100
commit0ae2e7f73c24779f8c99453fb02491382cc0520e (patch)
treef7bd68672746107c5bcc91686fef48c0f5c11bf2 /server.js
parent3a443402a6f22e4ac1fd80af62abfef7efd6d7a4 (diff)
downloadPeerTube-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.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/server.js b/server.js
index fe0cb237a..96c493f29 100644
--- a/server.js
+++ b/server.js
@@ -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 () {