Skip to content

Commit

Permalink
fix: pm2_env will nerver use in runtime judge
Browse files Browse the repository at this point in the history
Refs: #25
  • Loading branch information
peze committed Nov 12, 2019
1 parent aba8e22 commit 217cc06
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions get_process_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ function getProcessEnv(pid) {
});
const lines = output.split('\u0000');

var env = {ENABLE_NODE_LOG: '', NODE_LOG_DIR: '/tmp'};
var pm2_env = {};
var env = { ENABLE_NODE_LOG: '', NODE_LOG_DIR: '/tmp' };

for (var i = 0; i < lines.length; i++) {
const line = lines[i];
Expand All @@ -56,18 +55,8 @@ function getProcessEnv(pid) {
if (line.startsWith('NODE_LOG_DIR')) {
env.NODE_LOG_DIR = line.split('=')[1];
}

if (line.startsWith('pm2_env=')) {
try {
pm2_env = JSON.parse(line.substr('pm2_env='.length));
} catch (e) {
}
}
}

env.NODE_LOG_DIR = env.NODE_LOG_DIR || pm2_env.NODE_LOG_DIR;
env.ENABLE_NODE_LOG = env.ENABLE_NODE_LOG || pm2_env.ENABLE_NODE_LOG;

if (!env.NODE_LOG_DIR.endsWith('/')) {
env.NODE_LOG_DIR += '/';
}
Expand Down

0 comments on commit 217cc06

Please sign in to comment.