Skip to content

chruby version check fails because chruby is a function #9528

@forthrin

Description

@forthrin

Version information

macOS 26.3.1
ruby 4.0.3
bundler 4.0.11

Reproduction

$ brew install chruby
==> chruby ✔: stable 0.3.9 (bottled), HEAD
$ bundle env

Output

bash: chruby: command not found
## Environment
Tools
  chruby (VERSION STRING MISSING)

Analysis

$ git blame -L :self.chruby_version ./bundler/lib/bundler/env.rb
1e22b51dc84 (Andre Arko     2017-09-07 01:40:29 -0700 86)     def self.chruby_version
1e22b51dc84 (Andre Arko     2017-09-07 01:40:29 -0700 87)       return "not installed" unless Bundler.which("chruby-exec")
e145330f286 (Samuel Giddins 2017-09-13 17:32:49 -0500 88)       `chruby-exec -- chruby --version`.
e145330f286 (Samuel Giddins 2017-09-13 17:32:49 -0500 89)         sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1')
1e22b51dc84 (Andre Arko     2017-09-07 01:40:29 -0700 90)     end
1e22b51dc84 (Andre Arko     2017-09-07 01:40:29 -0700 91) 
$ type chruby | head -1
chruby is a function
$ chruby-exec --version
chruby version 0.3.9

Proposal

diff --git a/bundler/lib/bundler/env.rb b/bundler/lib/bundler/env.rb
index 074bef6edc..677dc8a7df 100644
--- a/bundler/lib/bundler/env.rb
+++ b/bundler/lib/bundler/env.rb
@@ -87,3 +87,3 @@ def self.chruby_version
       return "not installed" unless Bundler.which("chruby-exec")
-      `chruby-exec -- chruby --version`.
+      `chruby-exec --version`.
         sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions