Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 72 forks source link

pm2 deploy <env> exec/run "<command>" execute the second command on the local machine #163

Closed rduque1 closed 5 years ago

rduque1 commented 5 years ago

When I run:

pm2 deploy process.json staging exec "hostname && pwd" or pm2 deploy process.json staging exec "hostname ; pwd" the second command after the && or ; is executed on my local machine instead of the remote host.

If I escape the ampersand \&\& or the \;it works. But this is very counter intuitive as the command is between double quotes. It also work when the command is like "'\<commnad>'" or "\"\<command>\""

jkantr commented 5 years ago

I can confirm this behavior... honestly it's pretty dangerous running cli commands in a different place than the user expects them to end up...

jkantr commented 5 years ago

Let me give some useful feedback - the fix here is probably altering:

https://github.com/Unitech/pm2-deploy/blob/master/deploy#L124

I think $shell $@ here is just always wrong. I'm not a sh guy really but from what I can gather:

$shell "$*" is correct here

Unitech commented 5 years ago

will be fixed on next pm2 release