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.
You're looking for lcd
(l
for local) rather than cd
(which is remote).