Properly clean up socket on exit

`file.unlink` requires a callback, which we didn't set.
This commit adds a callback with (error) logging, enabling HedgeDoc
to properly clean up the socket.

Closes #784

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-03-29 22:23:09 +02:00
parent 6531ea1a21
commit 6501e62557
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

8
app.js
View file

@ -301,7 +301,13 @@ function handleTermSignals () {
}, 0)
})
if (config.path) {
fs.unlink(config.path)
fs.unlink(config.path, err => {
if (err) {
logger.error(`Could not cleanup socket: ${err.message}`)
} else {
logger.info('Successfully cleaned up socket')
}
})
}
const checkCleanTimer = setInterval(function () {
if (realtime.isReady()) {