diff --git a/lib/API.js b/lib/API.js index 7c7b997bd..60c69380d 100644 --- a/lib/API.js +++ b/lib/API.js @@ -4,14 +4,14 @@ * can be found in the LICENSE file. */ -var commander = require('commander'); -var fs = require('fs'); -var path = require('path'); -var async = require('async'); -var debug = require('debug')('pm2:cli'); -var util = require('util'); -var chalk = require('chalk'); -var fclone = require('fclone'); +const commander = require('commander'); +const fs = require('fs'); +const path = require('path'); +const async = require('async'); +const debug = require('debug')('pm2:cli'); +const util = require('util'); +const chalk = require('chalk'); +const fclone = require('fclone'); var conf = require('../constants.js'); var Client = require('./Client'); @@ -49,7 +49,7 @@ class API { constructor (opts) { if (!opts) opts = {}; - var that = this; + const that = this; this.daemon_mode = typeof(opts.daemon_mode) == 'undefined' ? true : opts.daemon_mode; this.pm2_home = conf.PM2_ROOT_PATH; @@ -78,8 +78,8 @@ class API { } else if (opts.independent == true && conf.IS_WINDOWS === false) { // Create an unique pm2 instance - var crypto = require('crypto'); - var random_file = crypto.randomBytes(8).toString('hex'); + const crypto = require('crypto'); + const random_file = crypto.randomBytes(8).toString('hex'); this.pm2_home = path.join('/tmp', random_file); // If we dont explicitly tell to have a daemon @@ -111,7 +111,7 @@ class API { this.gl_is_km_linked = false; try { - var pid = fs.readFileSync(conf.INTERACTOR_PID_PATH); + const pid = fs.readFileSync(conf.INTERACTOR_PID_PATH); pid = parseInt(pid.toString().trim()); process.kill(pid, 0); that.gl_is_km_linked = true;