Skip to content

Commit

Permalink
refactor: change safety var to const
Browse files Browse the repository at this point in the history
  • Loading branch information
wallet77 committed Feb 27, 2018
1 parent 0cab888 commit 047aa49
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/API.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* can be found in the LICENSE file. * can be found in the LICENSE file.
*/ */


var commander = require('commander'); const commander = require('commander');
var fs = require('fs'); const fs = require('fs');
var path = require('path'); const path = require('path');
var async = require('async'); const async = require('async');
var debug = require('debug')('pm2:cli'); const debug = require('debug')('pm2:cli');
var util = require('util'); const util = require('util');
var chalk = require('chalk'); const chalk = require('chalk');
var fclone = require('fclone'); const fclone = require('fclone');


var conf = require('../constants.js'); var conf = require('../constants.js');
var Client = require('./Client'); var Client = require('./Client');
Expand Down Expand Up @@ -49,7 +49,7 @@ class API {


constructor (opts) { constructor (opts) {
if (!opts) opts = {}; if (!opts) opts = {};
var that = this; const that = this;


this.daemon_mode = typeof(opts.daemon_mode) == 'undefined' ? true : opts.daemon_mode; this.daemon_mode = typeof(opts.daemon_mode) == 'undefined' ? true : opts.daemon_mode;
this.pm2_home = conf.PM2_ROOT_PATH; this.pm2_home = conf.PM2_ROOT_PATH;
Expand Down Expand Up @@ -78,8 +78,8 @@ class API {
} }
else if (opts.independent == true && conf.IS_WINDOWS === false) { else if (opts.independent == true && conf.IS_WINDOWS === false) {
// Create an unique pm2 instance // Create an unique pm2 instance
var crypto = require('crypto'); const crypto = require('crypto');
var random_file = crypto.randomBytes(8).toString('hex'); const random_file = crypto.randomBytes(8).toString('hex');
this.pm2_home = path.join('/tmp', random_file); this.pm2_home = path.join('/tmp', random_file);


// If we dont explicitly tell to have a daemon // If we dont explicitly tell to have a daemon
Expand Down Expand Up @@ -111,7 +111,7 @@ class API {
this.gl_is_km_linked = false; this.gl_is_km_linked = false;


try { try {
var pid = fs.readFileSync(conf.INTERACTOR_PID_PATH); const pid = fs.readFileSync(conf.INTERACTOR_PID_PATH);
pid = parseInt(pid.toString().trim()); pid = parseInt(pid.toString().trim());
process.kill(pid, 0); process.kill(pid, 0);
that.gl_is_km_linked = true; that.gl_is_km_linked = true;
Expand Down

0 comments on commit 047aa49

Please sign in to comment.