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

@code-tree code-tree commented Jul 27, 2018

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

@bitprophet bitprophet commented Jul 31, 2018

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

@bitprophet bitprophet commented Jun 3, 2019

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 (😩)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants