-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[Fix #5358] Handle files conflicts when using bundle gem
#5415
[Fix #5358] Handle files conflicts when using bundle gem
#5415
Conversation
726ba22
to
4334b97
Compare
lib/bundler/cli/gem.rb
Outdated
@@ -139,6 +139,10 @@ def run | |||
|
|||
# Open gemspec in editor | |||
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit] | |||
rescue SystemCallError => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use SharedHelpers.filesystem_access
instead of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@segiddins the error is thrown by thor.template
. Should I monkey-patch it? Or how would you use SharedHelpers.filesystem_access
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind the comment above 👍 Will do it, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@segiddins I have just noticed that here https://github.com/bundler/bundler/blob/master/lib/bundler/shared_helpers.rb#L120 when Errno::EEXIST
happen a generic RuntimeError
is thrown. Are you OK if I create a custom exception for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah in that case, please use both filesystem_access
and separately rescue EEXIST
and raise a GenericSystemCallError
for it?
4334b97
to
cc842f4
Compare
`bundle gem` command fails with an exception when creating a gem having the same name of a file in the specified path. For instance: > touch hello > bundle gem hello This bug is due to Thor gem. At the moment, Thor does not handle conflicts between files and directories. This commit mitigates the problem by rescuing the exception from Thor and gracefully exit with an error message.
cc842f4
to
9a15da1
Compare
@segiddins I have updated the PR. What do you think? |
Thanks! |
📌 Commit 9a15da1 has been approved by |
…ddins [Fix #5358] Handle files conflicts when using `bundle gem` `bundle gem` command fails with an exception when creating a gem having the same name of a file in the specified path. For instance: > touch hello > bundle gem hello This bug is due to Thor gem. At the moment, Thor does not handle conflicts between files and directories. This commit mitigates the problem by rescuing the exception from Thor and gracefully exit with an error message. Fixes #5358
☀️ Test successful - status-travis |
…ddins [Fix #5358] Handle files conflicts when using `bundle gem` `bundle gem` command fails with an exception when creating a gem having the same name of a file in the specified path. For instance: > touch hello > bundle gem hello This bug is due to Thor gem. At the moment, Thor does not handle conflicts between files and directories. This commit mitigates the problem by rescuing the exception from Thor and gracefully exit with an error message. Fixes #5358 (cherry picked from commit f93accc)
bundle gem
command fails with an exception when creating a gem havingthe same name of a file in the specified path.
For instance:
This bug is due to Thor gem. At the moment, Thor does not handle
conflicts between files and directories. This commit mitigates the
problem by rescuing the exception from Thor and gracefully exit with an
error message.
Fixes #5358