diff --git a/lib/API.js b/lib/API.js index c42cf837..7c7b997b 100644 --- a/lib/API.js +++ b/lib/API.js @@ -185,22 +185,10 @@ class API { if (that.pm2_home.indexOf('.pm2') > -1) return cb(new Error('Destroy is not a allowed method on .pm2')); - if (fs.accessSync) { - fs.access(test_path, fs.R_OK, function(err) { - if (err) return cb(err); - debug('Deleting temporary folder %s', that.pm2_home); - exec(cmd, cb); - }); - return false; - } - - // Support for Node 0.10 - fs.exists(test_path, function(exist) { - if (exist) { - debug('Deleting temporary folder %s', that.pm2_home); - exec(cmd, cb); - } - return cb(null); + fs.access(test_path, fs.R_OK, function(err) { + if (err) return cb(err); + debug('Deleting temporary folder %s', that.pm2_home); + exec(cmd, cb); }); }); } @@ -858,15 +846,7 @@ class API { } else { var data = null; - var isAbsolute = false - - //node 0.11 compatibility #2815 - if (typeof path.isAbsolute === 'function') { - isAbsolute = path.isAbsolute(file) - } else { - isAbsolute = require('./tools/IsAbsolute.js')(file) - } - + var isAbsolute = path.isAbsolute(file) var file_path = isAbsolute ? file : path.join(that.cwd, file); debug('Resolved filepath %s', file_path);