Skip to content

Setting env.path affects local() operation #659

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

Closed
floledermann opened this issue Jun 1, 2012 · 1 comment
Closed

Setting env.path affects local() operation #659

floledermann opened this issue Jun 1, 2012 · 1 comment

Comments

@floledermann
Copy link

I am on Windows so I am not sure if this affects other Platforms.

It turns out that when env.path is set, local() stops executing commands on Windows.

Simple testcase:

def test():
    local('echo TEST')

def test_failing():
    env.path = 'foo'
    local('echo TEST')

Output:

$ fab test
[localhost] local: echo TEST
TEST

Done.

$ fab test_failing
[localhost] local: echo TEST

Done.

Note the missing output in the second case.

As far as I understood, env.path only affects run/sudo commands, or am I getting something wrong?

OS: Windows 7
fabric Version: 1.3.7

@bitprophet
Copy link
Member

Looks like the docs are inaccurate -- local does call the internal subroutine which inserts shell env vars before the command, and part of that is honoring env.path.

This is the first time I recall this coming up, though I think it may be Windows' "fault" in the sense that the shell env var stuff is a Unix/POSIX convention and is probably not valid for Windows shells. What your failing example is invoking locally, and you can verify this with --show=debug, is PATH=foo echo TEST (versus simply echo TEST.)

For now I'd prefer to update the docs to be accurate, instead of changing the behavior, as others may be relying on the behavior as implemented (despite the doc inaccuracy.)

In your case, hopefully there's a way you can limit the env.path modification to only the places you need it, or conversely, wrap local calls with with settings(path=''):.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants