-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong operation of environment variable. #1124
Comments
Did this bug occured to you or you've been just reading PM2 code for fun ? :) |
I tried to call
But I could not get stdout, stderr. I found wrong operation of environment variable. https://github.com/Unitech/PM2/blob/0.12.8/lib/Common.js#L169 Thanks. |
Why do you require pm2 without using it? If you want to see the output, and dont use require pm2, just comment it. If you use require pm2, you should do something like:
|
Oh, That's right. I knew that. #!/usr/bin/env node
var pm2 = require("pm2");
var child_process = require("child_process");
var path = require("path");
if (process.argv[2] === "pm2") {
var args = process.argv.slice(3);
var pm2_path = path.resolve(__dirname, "node_modules/.bin/pm2");
child_process.spawn(pm2_path, args, {stdio: "inherit"});
}
/* use pm2.connect (ellipsis) */ I can call pm2 command from my_command. Ex: I can not get output because wrong operation of |
If my PR accepted, I can call the following code and get outputs! #!/usr/bin/env node
var pm2 = require("pm2");
var child_process = require("child_process");
var path = require("path");
if (process.argv[2] === "pm2") {
process.env.PM2_PROGRAMMATIC = 'false'; //set false
var args = process.argv.slice(3);
var pm2_path = path.resolve(__dirname, "node_modules/.bin/pm2");
child_process.spawn(pm2_path, args, {stdio: "inherit"});
}
/* use pm2.connect (ellipsis) */ |
I think that this commit d5e731e is wrong operation of environment variable.
Example: https://github.com/Unitech/PM2/blob/0.12.8/lib/CLI.js#L961
process.env.PM2_PROGRAMMATIC === true
It absolutely not true, because environment variable is string.
The text was updated successfully, but these errors were encountered: