summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/exec.rb9
-rw-r--r--spec/commands/exec_spec.rb6
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index f0ce450959..b02a610c21 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -63,6 +63,7 @@ module Bundler
args.pop if args.last.is_a?(Hash)
ARGV.replace(args)
$0 = file
+ Process.setproctitle(process_title(file, *args))
ui = Bundler.ui
Bundler.ui = nil
require "bundler/setup"
@@ -78,6 +79,14 @@ module Bundler
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
end
+ def process_title(file, *args)
+ if args.empty?
+ file
+ else
+ "#{file} #{args.join(" ")}".strip
+ end
+ end
+
def ruby_shebang?(file)
possibilities = [
"#!/usr/bin/env ruby\n",
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 4e2bdbbb7a..e2283d7aa4 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -462,6 +462,7 @@ describe "bundle exec" do
puts "EXEC: \#{caller.grep(/load/).empty? ? 'exec' : 'load'}"
puts "ARGS: \#{$0} \#{ARGV.join(' ')}"
puts "RACK: \#{RACK}"
+ puts "PROCESS: \#{`ps --no-headers -oargs -p\#{Process.pid}`.strip}"
RUBY
before do
@@ -476,8 +477,9 @@ describe "bundle exec" do
let(:exec) { "EXEC: load" }
let(:args) { "ARGS: #{path} arg1 arg2" }
let(:rack) { "RACK: 1.0.0" }
+ let(:process) { "PROCESS: #{path} arg1 arg2" }
let(:exit_code) { 0 }
- let(:expected) { [exec, args, rack].join("\n") }
+ let(:expected) { [exec, args, rack, process].join("\n") }
let(:expected_err) { "" }
subject { bundle "exec #{path} arg1 arg2" }
@@ -511,7 +513,7 @@ describe "bundle exec" do
let(:exit_code) { 1 }
let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
let(:expected_err) do
- "RuntimeError: ERROR\n #{path}:7" +
+ "RuntimeError: ERROR\n #{path}:8" +
(Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'")
end
it_behaves_like "it runs"