diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-02-07 12:01:40 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-02-07 12:01:40 +0100 |
commit | ac2f99eb75ea0295dc08e47b91f4b4d54829d004 (patch) | |
tree | 9f0d6d70be66545df336f75be5f1bdefa62c70ca /lib/webtorrent.js | |
parent | a030a9b234d315c180f40d8abd177637c1a91f6a (diff) | |
download | PeerTube-ac2f99eb75ea0295dc08e47b91f4b4d54829d004.tar.gz PeerTube-ac2f99eb75ea0295dc08e47b91f4b4d54829d004.tar.zst PeerTube-ac2f99eb75ea0295dc08e47b91f4b4d54829d004.zip |
Don't use process.exit, throw an error instead
Diffstat (limited to 'lib/webtorrent.js')
-rw-r--r-- | lib/webtorrent.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/webtorrent.js b/lib/webtorrent.js index 5f10322a5..cb641fead 100644 --- a/lib/webtorrent.js +++ b/lib/webtorrent.js | |||
@@ -43,8 +43,7 @@ function create (options, callback) { | |||
43 | 43 | ||
44 | // Run a timeout of 30s after which we exit the process | 44 | // Run a timeout of 30s after which we exit the process |
45 | var timeout_webtorrent_process = setTimeout(function () { | 45 | var timeout_webtorrent_process = setTimeout(function () { |
46 | logger.error('Timeout : cannot run the webtorrent process. Please ensure you have electron-prebuilt npm package installed with xvfb-run.') | 46 | throw new Error('Timeout : cannot run the webtorrent process. Please ensure you have electron-prebuilt npm package installed with xvfb-run.') |
47 | process.exit() | ||
48 | }, 30000) | 47 | }, 30000) |
49 | 48 | ||
50 | ipc.server.on(processKey + '.ready', function () { | 49 | ipc.server.on(processKey + '.ready', function () { |
@@ -54,8 +53,7 @@ function create (options, callback) { | |||
54 | }) | 53 | }) |
55 | 54 | ||
56 | ipc.server.on(processKey + '.exception', function (data) { | 55 | ipc.server.on(processKey + '.exception', function (data) { |
57 | logger.error('Received exception error from webtorrent process.', { exception: data.exception }) | 56 | throw new Error('Received exception error from webtorrent process.' + data.exception) |
58 | process.exit() | ||
59 | }) | 57 | }) |
60 | 58 | ||
61 | var webtorrent_process = spawn(pathUtils.join(__dirname, 'webtorrentProcess.js'), host, port, { detached: true }) | 59 | var webtorrent_process = spawn(pathUtils.join(__dirname, 'webtorrentProcess.js'), host, port, { detached: true }) |