Skip to content

Commit

Permalink
fix calling PM2 inside a script #4761
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Jun 29, 2020
1 parent e790d82 commit edbfb59
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,11 @@ Common.prepareAppConf = function(opts, app) {
}

app.env = [
{}, app.filter_env ? filterEnv(process.env) : env, app.env || {}
{}, (app.filter_env && app.filter_env.lengt > 0) ? filterEnv(env) : env, app.env || {}
].reduce(function(e1, e2){
return util._extend(e1, e2);
});


app.pm_cwd = cwd;
// Interpreter
try {
Expand Down Expand Up @@ -544,7 +543,7 @@ Common.safeExtend = function(origin, add){
if (!add || typeof add != 'object') return origin;

//Ignore PM2's set environment variables from the nested env
var keysToIgnore = ['name', 'exec_mode', 'env', 'args', 'pm_cwd', 'exec_interpreter', 'pm_exec_path', 'node_args', 'pm_out_log_path', 'pm_err_log_path', 'pm_pid_path', 'pm_id', 'status', 'pm_uptime', 'created_at', 'windowsHide', 'username', 'merge_logs', 'kill_retry_time', 'prev_restart_delay', 'instance_var', 'unstable_restarts', 'restart_time', 'axm_actions', 'pmx_module', 'command', 'watch', 'versioning', 'vizion_runing', 'MODULE_DEBUG', 'pmx', 'axm_options', 'created_at', 'watch', 'vizion', 'axm_dynamic', 'axm_monitor', 'instances', 'automation', 'autorestart', 'unstable_restart', 'treekill', 'exit_code', 'vizion'];
var keysToIgnore = ['name', 'exec_mode', 'env', 'args', 'pm_cwd', 'exec_interpreter', 'pm_exec_path', 'node_args', 'pm_out_log_path', 'pm_err_log_path', 'pm_pid_path', 'pm_id', 'status', 'pm_uptime', 'created_at', 'windowsHide', 'username', 'merge_logs', 'kill_retry_time', 'prev_restart_delay', 'instance_var', 'unstable_restarts', 'restart_time', 'axm_actions', 'pmx_module', 'command', 'watch', 'filter_env', 'versioning', 'vizion_runing', 'MODULE_DEBUG', 'pmx', 'axm_options', 'created_at', 'watch', 'vizion', 'axm_dynamic', 'axm_monitor', 'instances', 'automation', 'autorestart', 'unstable_restart', 'treekill', 'exit_code', 'vizion'];

var keys = Object.keys(add);
var i = keys.length;
Expand Down

0 comments on commit edbfb59

Please sign in to comment.