From e53706d98d6cdd562845808e30ef2865c4c4cbb4 Mon Sep 17 00:00:00 2001
From: Petr Balashov
Date: Wed, 29 Mar 2017 22:56:20 -0700
Subject: [PATCH] added try/catch komodo/debug.log access
---
routes/shepherd.js | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/routes/shepherd.js b/routes/shepherd.js
index 7b436bb..862e986 100644
--- a/routes/shepherd.js
+++ b/routes/shepherd.js
@@ -679,14 +679,18 @@ function herder(flock, data) {
console.log('selected data: ' + data);
// truncate 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);
- }
- });
+ try {
+ _fs.access(kmdDebugLogLocation, fs.constants.R_OK, function(err) {
+ if (err) {
+ console.log('error accessing ' + kmdDebugLogLocation);
+ } else {
+ console.log('truncate ' + kmdDebugLogLocation);
+ fs.unlink(kmdDebugLogLocation);
+ }
+ });
+ } catch(err) {
+ console.log('komodod debug.log access err: ' + err);
+ }
pm2.connect(true, function(err) { // start up pm2 god
if (err) {