From 6501e62557155ef9068637dd5b9009b7f99fe7a5 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Mon, 29 Mar 2021 22:23:09 +0200 Subject: 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 --- app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index ce37032b..51b5f093 100644 --- a/app.js +++ b/app.js @@ -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()) { -- cgit v1.2.3