summaryrefslogtreecommitdiff
path: root/lib/bundler/gem_helper.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-08-25 11:30:41 +0200
committergit <svn-admin@ruby-lang.org>2021-10-13 23:30:11 +0900
commit30b6df41440ea2a0421efd0f3146750e872760fc (patch)
treedbcbf4a6c5839d55c0407df410ce2305459e4c3d /lib/bundler/gem_helper.rb
parent853004e04d86502e1df509302a4c5dce03d9d40e (diff)
[rubygems/rubygems] Improve error messages in gem helpers
Previously they were printing the original command that was run, and telling the user to rerun it. However, the command sometimes would not match the exact command that was run (for example, when using the `--local` flag), and in any case, it's simpler and more useful to print the underlying error anyways. https://github.com/rubygems/rubygems/commit/5bc0d51b58
Diffstat (limited to 'lib/bundler/gem_helper.rb')
-rw-r--r--lib/bundler/gem_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 8e1dd7c4f2..01101205e3 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -98,9 +98,9 @@ module Bundler
built_gem_path ||= build_gem
cmd = [*gem_command, "install", built_gem_path.to_s]
cmd << "--local" if local
- _, status = sh_with_status(cmd)
+ out, status = sh_with_status(cmd)
unless status.success?
- raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
+ raise("Running `#{cmd}` failed with the following output:\n\n#{out}\n")
end
Bundler.ui.confirm "#{name} (#{version}) installed."
end
@@ -219,7 +219,7 @@ module Bundler
out, status = sh_with_status(cmd, &block)
unless status.success?
cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
- raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
+ raise("Running `#{cmd}` failed with the following output:\n\n#{out}\n")
end
out
end