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

Ensure dir change removed despite exceptions #557

Closed
wants to merge 1 commit into from

Conversation

code-tree
Copy link
Contributor

Hi, so I don't believe the current implementation of cd() handles exceptions. Take for example:

try:
    with c.cd('subdir'):
        c.run('ls')
        raise Exception()
finally:
    c.run('ls')

The final run() call is executed in the same dir as the first because the dir change wasn't popped.

Note: Please test before merging (I'm writing in github to save time)

@bitprophet
Copy link
Member

Good catch, thanks! Throwing in bugfix milestone, I'll handle backporting/testing when I get to it.

@bitprophet bitprophet added this to the Next bugfix milestone Jul 31, 2018
@bitprophet
Copy link
Member

Looks like #640 extends this to handle the same issue in the sibling method, cwd, linking here for posterity. Merging these two now and adding tests/changelog/etc (😩)

bitprophet added a commit that referenced this pull request Jun 3, 2019
@bitprophet bitprophet closed this in 06706e5 Jun 3, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants