Skip to content

path() context manager no longer works with local() #775

Description

@mars-f

The path() context manager stopped working for the local() operation in Fabric 1.5. It was working under 1.4.3.

We use the path context manager to add our local virtualenv's bin directory to our fabfile. Assuming that the virtualenv is in './env' relative to the fabfile, here is a task that shows the bug:

@task
def test_path():
    with path('env/bin', behavior='prepend'):
        local('echo $PATH')
        local('which pip')

Everything works under Fabric 1.4.3:

$ fab test_path
[localhost] local: echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
[localhost] local: which pip
env/bin/pip

Done.

It breaks under Fabric 1.5.0:

$ fab test_path
[localhost] local: echo $PATH
"env/bin":$PATH
[localhost] local: which pip
/bin/sh: 1: which: not found

Fatal error: local() encountered an error (return code 127) while executing 'which pip'

Aborting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions