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

Change @_env to local variable #345

Merged
merged 2 commits into from
Apr 29, 2016

Conversation

DylanFrese
Copy link
Contributor

In the SSHKit Abstract backend, the 'with' method declared an instance variable (@_env) that was only used in that method, and ensured it was unset before returning. This would cause errors when nesting 'with' calls, as the outer call would try to use and then unset @_env after the inner call already unset it. It has been changed to a regular local variable, as the desired behaviour is identical to using a local variable anyway.

This fixes Issue #43 and Issue #176

In the SSHKit Abstract backend, the 'with' method declared an instance variable (@_env) that was only used in that method, and ensured it was unset before returning. This would cause errors when nesting 'with' calls, as the outer call would try to use and then unset @_env after the inner call already unset it. It has been changed to a regular local variable, as the desired behaviour is identical to using a local variable anyway.
@leehambley
Copy link
Member

Could you check the build please @DylanFrese ?

@DylanFrese
Copy link
Contributor Author

@leehambley It looks like RuboCop is complaining about the fact that '_env' is a used variable and starts with an underscore. I did this because that's what the original variable was named (@_env), but I'll change it.

Change the name of a local variable in the 'with' method in the Abstract Backend from '_env' to 'env_old'. Variable names beginning with underscores are typically interpreted to mean that the variable is unused. The variable name has been changed to be more descriptive.
@DylanFrese
Copy link
Contributor Author

@leehambley Done

@leehambley
Copy link
Member

Thanks, LGTM I just would ask you to amend the commit again and credit yourself in the CHANGELOG if you're interested in being credited, if not just let me know and I'll merge the PR as-is.

@DylanFrese
Copy link
Contributor Author

You're free to merge it as-is.

@gucki
Copy link
Contributor

gucki commented Jun 14, 2016

@leehambley Could you please release a version with this fixed? For example capistrano whenever fails due to this bug.

@oprema
Copy link

oprema commented Jun 14, 2016

Yes this would be wonderful if @leehambley could fix this. My capistrano fails with the same error. Thanks.

@mattbrictson
Copy link
Member

I plan on releasing 1.11.0 in a few hours, which will include this fix.

@DylanFrese DylanFrese deleted the fix-nested-with branch June 14, 2016 15:59
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.

5 participants