summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2011-11-30 18:51:43 -0600
committerTerence Lee <hone02@gmail.com>2011-11-30 18:51:43 -0600
commit84d8c4b0bc246df50f1a191ec8ecd2ee53c683b7 (patch)
tree8e9caf225288871e82359670482938707a0421c1
parenta4441d2fd417f18df5b54e861a9618ebb7405949 (diff)
downloadbundler-84d8c4b0bc246df50f1a191ec8ecd2ee53c683b7.tar.gz
#1519 gracefully handle bundle exec with no args
-rw-r--r--lib/bundler/cli.rb3
-rw-r--r--spec/other/exec_spec.rb10
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 1563d90890..d8545899ba 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -415,6 +415,9 @@ module Bundler
Bundler.ui.error "bundler: command not found: #{ARGV.first}"
Bundler.ui.warn "Install missing gem executables with `bundle install`"
exit 127
+ rescue ArgumentError
+ Bundler.ui.error "bundle exec needs a command to run"
+ exit 128
end
end
diff --git a/spec/other/exec_spec.rb b/spec/other/exec_spec.rb
index 92d591242b..eac881d222 100644
--- a/spec/other/exec_spec.rb
+++ b/spec/other/exec_spec.rb
@@ -121,6 +121,16 @@ describe "bundle exec" do
out.should include("bundler: not executable: ./foo")
end
+ it "errors nicely when no arguments are passed" do
+ install_gemfile <<-G
+ gem "rack"
+ G
+
+ bundle "exec", :exitstatus => true
+ # exitstatus.should eq(128)
+ out.should include("bundle exec needs a command to run")
+ end
+
describe "with gem executables" do
describe "run from a random directory" do
before(:each) do