From f9369459db460938b654e6c11267b3536f9a55eb Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Wed, 4 Jun 2014 13:44:59 +0000 Subject: [PATCH] Fix error when running Ghost with a socket fixes #2879 - Syncronously unlink old socket file --- core/server/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/server/index.js b/core/server/index.js index 8acbd25e7f..d4c34b78df 100644 --- a/core/server/index.js +++ b/core/server/index.js @@ -261,13 +261,16 @@ function init(server) { // ## Start Ghost App if (config.getSocket()) { // Make sure the socket is gone before trying to create another - fs.unlink(config.getSocket(), function (err) { - /*jshint unused:false*/ - httpServer = server.listen( - config.getSocket() - ); - fs.chmod(config.getSocket(), '0660'); - }); + try { + fs.unlinkSync(config.getSocket()); + } catch (e) { + // We can ignore this. + } + + httpServer = server.listen( + config.getSocket() + ); + fs.chmod(config.getSocket(), '0660'); } else { httpServer = server.listen(