Open lardissone opened 6 years ago
@phra I think I've found the issue: childProcess.spawn
command is not used correctly when ENV vars are sent.
In the docs they say the envs should be passed in the options
object (third parameter).
We should do something like in the spawn function:
function spawn(hostJSON, args, envVars, cb) {
var shellSyntaxCommand = "echo '" + hostJSON + "' | \"" + __dirname.replace(/\\/g, '/') + "/deploy\" " + args.join(' ');
var options = { stdio: 'inherit' };
if (envVars && typeof envVars === 'object') {
options.env = envVars;
}
var proc = childProcess.spawn('sh', ['-c', shellSyntaxCommand], options)
...
I wouldn't be able to work on this today, but this probably helps.
@lardissone We need the env to be given in the remote server, if you give it to the spawn call it will only be used to spawn the ssh
binary
@vmarchaud ah, got it!
Hi there, Is the bug still present ? I'm facing this issue in post-deploy : the pm2 shell doesn't seems to have my ENV vars (database url for exemple). Thank you and sorry for bad english
Same problem
Referring to #152 fix, now ENV vars are sent to post-deploy command but vars are not exported apparently.