codekitchen / dinghy

faster, friendlier Docker on OS X. Deprecated.
MIT License
2.12k stars 109 forks source link

eval writes wrong env #256

Closed hezhizhen closed 7 years ago

hezhizhen commented 7 years ago

I launched dinghy, and the output of dinghy env was:

set -gx DOCKER_HOST tcp://192.168.99.100:2376
set -gx DOCKER_CERT_PATH /Users/hezhizhen/.docker/machine/machines/dinghy
set -gx DOCKER_TLS_VERIFY 1
set -gx DOCKER_MACHINE_NAME dinghy

When I ran eval (dinghy env) (I use fish shell), the env was:

DOCKER_CERT_PATH=/Users/hezhizhen/.docker/machine/machines/dinghy
DOCKER_HOST=tcp://192.168.99.100:2376set-gxDOCKER_CERT_PATH/Users/hezhizhen/.docker/machine/machines/dinghyset-gxDOCKER_TLS_VERIFY1set-gxDOCKER_MACHINE_NAMEdinghy
DOCKER_MACHINE_NAME=dinghy
DOCKER_TLS_VERIFY=1
codekitchen commented 7 years ago

I've never used the Fish shell myself, the PR to support it came from somebody else. But when I run docker-machine env dinghy --shell=fish I see some differences in formatting:

set -gx DOCKER_TLS_VERIFY "1";
set -gx DOCKER_HOST "tcp://192.168.64.6:2376";
set -gx DOCKER_CERT_PATH "/Users/brianp/.docker/machine/machines/dinghy";
set -gx DOCKER_MACHINE_NAME "dinghy";

So I wonder if we need to add quotes and semicolons to the dinghy env output to fix this. Seems worth trying, I'll make that change.

codekitchen commented 7 years ago

Yeah that fixed it, I did a quick brew install fish and tried it out.

https://github.com/codekitchen/dinghy/commit/c8a44d3116c4a676d237186756b198768cdff8ac

You can install Dinghy's master branch using the instructions in the README to get the fix, until I cut a new release.

hezhizhen commented 7 years ago

I had manually written the output of dinghy env to config.fish, and thus solved the problem. When a new version is released, I will update it and try it. Thank you for your reply and solution.