p0deje/vagrant-exec

binstubs and vagrant exec foo interact with environment variables differently

Closed this issue · 3 comments

a python virtualenv can be activated by including its bin directory in the path, so the following works well for vagrant exec foo style calls

config.exec.commands "*", env: { "PATH" => "/home/vagrant/env/bin:$PATH" }

in this case $PATH is evaluated on the server, but when generating binstubs, it would create:

ssh -F .vagrant/ssh_config -q -t default "bash -l -c 'export PATH=/home/vagrant/env/bin:$PATH && make $@'"

this evaluates $PATH on the client side instead.

escaping the string as follows causes both to evaluate the path on the server side.

ssh -F .vagrant/ssh_config -q -t default "bash -l -c 'export PATH=/home/vagrant/env/bin:\$PATH && make $@'"

Thanks for the bug report! Are you willing to submit a pull request fixing this?

I am not sure where to start but I will take a look when i find some free time.

Thanks, let me know if you need any assistance.