From b68ec0e90f360f8442f9c83bfa2cdc5a963e7d22 Mon Sep 17 00:00:00 2001 From: Petr Balashov Date: Tue, 7 Mar 2017 14:15:35 +0100 Subject: [PATCH] added komodo/debug.log unhandled error fix --- routes/shepherd.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routes/shepherd.js b/routes/shepherd.js index b2ea5a1..c581158 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -1250,11 +1250,19 @@ function herder(flock, data) { } if (flock === 'komodod') { + var kmdDebugLogLocation = komodoDir + '/debug.log'; console.log('komodod flock selected...'); console.log('selected data: ' + data); // truncate debug.log - fs.unlink(komodoDir + '/debug.log'); + _fs.access(kmdDebugLogLocation, fs.constants.R_OK, function(err) { + if (err) { + console.log('error accessing ' + kmdDebugLogLocation); + } else { + console.log('truncate ' + kmdDebugLogLocation); + fs.unlink(kmdDebugLogLocation); + } + }); pm2.connect(true, function(err) { // start up pm2 god if (err) {