Fix error when running Ghost with a socket

fixes #2879
- Syncronously unlink old socket file
This commit is contained in:
Fabian Becker 2014-06-04 13:44:59 +00:00
parent 1ae98df995
commit f9369459db

View File

@ -261,13 +261,16 @@ function init(server) {
// ## Start Ghost App // ## Start Ghost App
if (config.getSocket()) { if (config.getSocket()) {
// Make sure the socket is gone before trying to create another // Make sure the socket is gone before trying to create another
fs.unlink(config.getSocket(), function (err) { try {
/*jshint unused:false*/ fs.unlinkSync(config.getSocket());
} catch (e) {
// We can ignore this.
}
httpServer = server.listen( httpServer = server.listen(
config.getSocket() config.getSocket()
); );
fs.chmod(config.getSocket(), '0660'); fs.chmod(config.getSocket(), '0660');
});
} else { } else {
httpServer = server.listen( httpServer = server.listen(