Skip to content
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

Improve docs; add example context managers #1881

Open
klahnakoski opened this issue Sep 27, 2018 · 2 comments
Open

Improve docs; add example context managers #1881

klahnakoski opened this issue Sep 27, 2018 · 2 comments

Comments

@klahnakoski
Copy link

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

@mandarvaze
Copy link

The document referred above clearly says :

with cd is not fully implemented for the remote side of things

@pete312
Copy link

pete312 commented Oct 20, 2018

@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")

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

3 participants