The documentation shows how to execute a command with a particular code_dir
c.run("cd {} && git pull".format(code_dir))
Please change the example to use the cd() context manager. I have not idea how to do that.
http://www.fabfile.org/upgrading.html#actual-remote-steps
The document referred above clearly says :
with cdis not fully implemented for the remote side of things
@mandarvaze cd is implemented with remote run. Some example in the documentation is what the OP is asking for. @klahnakoski this is how its done.
@task
def cd_example(ctx):
ctx.run("pwd")
with ctx.cd("/etc"):
ctx.run("pwd")
Most helpful comment
@mandarvaze cd is implemented with remote run. Some example in the documentation is what the OP is asking for. @klahnakoski this is how its done.