mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Unexpected error if uiPort already in use
This commit is contained in:
parent
d87cc471a0
commit
15d642c55d
11
red.js
11
red.js
@ -149,8 +149,7 @@ if (settings.httpStatic) {
|
||||
app.use("/",express.static(settings.httpStatic));
|
||||
}
|
||||
|
||||
RED.start().then(function() {
|
||||
if (settings.httpAdminRoot !== false || settings.httpNodeRoot !== false || settings.httpStatic) {
|
||||
function getListenPath() {
|
||||
var listenPath = 'http'+(settings.https?'s':'')+'://'+
|
||||
(settings.uiHost == '0.0.0.0'?'127.0.0.1':settings.uiHost)+
|
||||
':'+settings.uiPort;
|
||||
@ -159,12 +158,16 @@ RED.start().then(function() {
|
||||
} else if (settings.httpStatic) {
|
||||
listenPath += "/";
|
||||
}
|
||||
return listenPath;
|
||||
}
|
||||
|
||||
RED.start().then(function() {
|
||||
if (settings.httpAdminRoot !== false || settings.httpNodeRoot !== false || settings.httpStatic) {
|
||||
server.listen(settings.uiPort,settings.uiHost,function() {
|
||||
if (settings.httpAdminRoot === false) {
|
||||
util.log('[red] Admin UI disabled');
|
||||
}
|
||||
util.log('[red] Server now running at '+listenPath);
|
||||
util.log('[red] Server now running at '+getListenPath());
|
||||
});
|
||||
} else {
|
||||
util.log('[red] Running in headless mode');
|
||||
@ -174,7 +177,7 @@ RED.start().then(function() {
|
||||
|
||||
process.on('uncaughtException',function(err) {
|
||||
if (err.errno === "EADDRINUSE") {
|
||||
util.log('[red] Unable to listen on '+listenPath);
|
||||
util.log('[red] Unable to listen on '+getListenPath());
|
||||
util.log('[red] Error: port in use');
|
||||
} else {
|
||||
util.log('[red] Uncaught Exception:');
|
||||
|
Loading…
Reference in New Issue
Block a user