mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Handle port-in-use error on start-up
This commit is contained in:
parent
c20128b80f
commit
c39f4f9738
21
red.js
21
red.js
@ -163,6 +163,16 @@ function getListenPath() {
|
||||
|
||||
RED.start().then(function() {
|
||||
if (settings.httpAdminRoot !== false || settings.httpNodeRoot !== false || settings.httpStatic) {
|
||||
server.on('error', function(err) {
|
||||
if (err.errno === "EADDRINUSE") {
|
||||
util.log('[red] Unable to listen on '+getListenPath());
|
||||
util.log('[red] Error: port in use');
|
||||
} else {
|
||||
util.log('[red] Uncaught Exception:');
|
||||
util.log(err.stack);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
server.listen(settings.uiPort,settings.uiHost,function() {
|
||||
if (settings.httpAdminRoot === false) {
|
||||
util.log('[red] Admin UI disabled');
|
||||
@ -176,14 +186,9 @@ RED.start().then(function() {
|
||||
|
||||
|
||||
process.on('uncaughtException',function(err) {
|
||||
if (err.errno === "EADDRINUSE") {
|
||||
util.log('[red] Unable to listen on '+getListenPath());
|
||||
util.log('[red] Error: port in use');
|
||||
} else {
|
||||
util.log('[red] Uncaught Exception:');
|
||||
util.log(err.stack);
|
||||
}
|
||||
process.exit(1);
|
||||
util.log('[red] Uncaught Exception:');
|
||||
util.log(err.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user