Fabric's cd context manager does not work

Question:

I have set up my development environment on a new PC and seems I am having strange error with Fabric. Its ‘cd’ context manager seems does not change the current directory, and thus a lot of my commands don’t work. I have written the test and it showed me results I have not expected to get:

from __future__ import with_statement
from fabric.api import local, run, cd

def xxx():
    with cd("src"):
        local("pwd")

Here are the results after running fab xxx:

[localhost] local: pwd
/home/pioneer/workspace/myproject

But instead of /home/pioneer/workspace/myproject there should be /home/pioneer/workspace/myproject/src, I think.

Asked By: Serge Tarkovski

||

Answers:

You’re looking for lcd (l for local) rather than cd (which is remote).

Answered By: Daniel Roseman
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.