Commit 528474d1 authored by Leo Iannacone's avatar Leo Iannacone

handle with EADDRINUSE

parent ed95eb93
...@@ -43,11 +43,6 @@ if (config.routes.preferences) ...@@ -43,11 +43,6 @@ if (config.routes.preferences)
// Listening // Listening
var server = app.listen(config.port, config.host, null, function(err){ var server = app.listen(config.port, config.host, null, function(err){
if (err) {
console.log(err)
return
}
// Checking nodejs with sudo: // Checking nodejs with sudo:
// Find out which user used sudo through the environment variable // Find out which user used sudo through the environment variable
// and set his user id // and set his user id
...@@ -73,3 +68,13 @@ var server = app.listen(config.port, config.host, null, function(err){ ...@@ -73,3 +68,13 @@ var server = app.listen(config.port, config.host, null, function(err){
console.log("Debomatic-webui listening on %s:%d in %s mode", app.address().address, app.address().port, app.settings.env); console.log("Debomatic-webui listening on %s:%d in %s mode", app.address().address, app.address().port, app.settings.env);
}); });
server.on('error', function (e) {
if (e.code == 'EADDRINUSE') {
console.log('Address in use %s:%d. Exit.', config.host, config.port);
process.exit(1);
}
else {
console.error(e);
}
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment