From 7f95bdfe6f3b78e85c5397a1ce10d8230927aa4b Mon Sep 17 00:00:00 2001 From: Davis <2466545+bojars@users.noreply.github.com> Date: Thu, 14 Sep 2017 12:00:13 +0300 Subject: [PATCH] In --no-daemon unlink of nonexisting pidfile When running application using --no-deamon, when process is killed with signal SIGTERM, it exits with code 1, due to fact that pidfile does not exist --- loader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loader.js b/loader.js index eb29cdca74..f2a511336b 100644 --- a/loader.js +++ b/loader.js @@ -187,7 +187,9 @@ Loader.stop = function () { killWorkers(); // Clean up the pidfile - fs.unlinkSync(pidFilePath); + if (nconf.get('daemon') !== 'false' && nconf.get('daemon') !== false) { + fs.unlinkSync(pidFilePath); + } }; function killWorkers() {