def run
ui = Bundler.ui
raise ArgumentError if cmd.nil?
SharedHelpers.set_bundle_environment
bin_path = Bundler.which(@cmd)
if bin_path
Bundler.ui = nil
Kernel.exec(bin_path, *args)
end
Bundler.definition.validate_ruby!
Bundler.load.setup_environment
Bundler.ui = nil
Kernel.exec(@cmd, *args)
rescue Errno::EACCES, Errno::ENOEXEC
Bundler.ui = ui
Bundler.ui.error "bundler: not executable: #{cmd}"
exit 126
rescue Errno::ENOENT
Bundler.ui = ui
Bundler.ui.error "bundler: command not found: #{cmd}"
Bundler.ui.warn "Install missing gem executables with `bundle install`"
exit 127
rescue ArgumentError
Bundler.ui = ui
Bundler.ui.error "bundler: exec needs a command to run"
exit 128
end