Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

bundle exec via kernel load doesn't need to rescue exceptions #6091

Closed
wants to merge 2 commits into from

Conversation

dekellum
Copy link
Contributor

Make bundle exec via Kernel.load handle exceptions just like a
bundler binstub: Kernel::load is called and any exceptions raised are
allowed to bubble up and be handled in the default way by the ruby
interpreter.

What was the end-user problem that led to this PR?

Fixes #6090

What was your diagnosis of the problem?

CLI::Exec#kernel_load should not rescue the SignalException

What is your fix for the problem, implemented in this PR?

Remove rescue blocks in this function

Why did you choose this fix out of the possible options?

An alternative would be to include SignalException along with SystemExit to bypass the rescue Exeption block below. However bundle exec with kernel load should really IMO, behave identically to a bundle binstub generated wrapper. These wrappers just call Kernel::load without any rescues.

Make `bundle exec` via Kernel.load handle exceptions just like a
bundler binstub: Kernel.load is called and any exceptions raised are
allowed to bubble up and be handled in the default way by the ruby
interpreter.

github: fixes rubygems#6090
@ghost
Copy link

ghost commented Oct 11, 2017

Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack.

For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide

Silences a fare Rubocop offense
@dekellum
Copy link
Contributor Author

Closing in deference to #6092.

@dekellum dekellum closed this Oct 11, 2017
bundlerbot added a commit that referenced this pull request Oct 18, 2017
…ddins

Avoid bundle exec rescue of SignalException

Avoid rescue of SignalException in kernel_load and with_friendly_errors This allows SignalException to be handled gracefully by the ruby interpreter.

This supersedes #6091.

### What was the end-user problem that led to this PR?

Fixes #6090

### What was your diagnosis of the problem?

CLI::Exec#kernel_load should not rescue the SignalException. Neither should with_friendly_errors, so it unwinds all the way to the ruby interpreter.

### What is your fix for the problem, implemented in this PR?

Two rescue and re-raises specific to SignalException.

### Why did you choose this fix out of the possible options?

My first naive attempt was #6091, where I had missed the outer rescue in with_friendly_errors, all of the other special friendly error behavior, and the spec dependencies. While I still suspect that kernel_load and friendly_errors might be rescuing/handling more than they should (for comparison: binstub doesn't do this) this is a much more minimal, safer, and easier fix to #6090.
segiddins pushed a commit that referenced this pull request Oct 30, 2017
…ddins

Avoid bundle exec rescue of SignalException

Avoid rescue of SignalException in kernel_load and with_friendly_errors This allows SignalException to be handled gracefully by the ruby interpreter.

This supersedes #6091.

### What was the end-user problem that led to this PR?

Fixes #6090

### What was your diagnosis of the problem?

CLI::Exec#kernel_load should not rescue the SignalException. Neither should with_friendly_errors, so it unwinds all the way to the ruby interpreter.

### What is your fix for the problem, implemented in this PR?

Two rescue and re-raises specific to SignalException.

### Why did you choose this fix out of the possible options?

My first naive attempt was #6091, where I had missed the outer rescue in with_friendly_errors, all of the other special friendly error behavior, and the spec dependencies. While I still suspect that kernel_load and friendly_errors might be rescuing/handling more than they should (for comparison: binstub doesn't do this) this is a much more minimal, safer, and easier fix to #6090.

(cherry picked from commit 6d0b74c)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bundle exec rescues 'SignalException' and aborts
1 participant