{"action":"created","issue":{"url":"https://api.github.com/repos/sstephenson/rbenv/issues/14","labels_url":"https://api.github.com/repos/sstephenson/rbenv/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/sstephenson/rbenv/issues/14/comments","events_url":"https://api.github.com/repos/sstephenson/rbenv/issues/14/events","html_url":"https://github.com/sstephenson/rbenv/issues/14","id":1351625,"number":14,"title":"Shims are incompatible with `ruby -S`","user":{"login":"sstephenson","id":2603,"avatar_url":"https://avatars.githubusercontent.com/u/2603?v=3","gravatar_id":"","url":"https://api.github.com/users/sstephenson","html_url":"https://github.com/sstephenson","followers_url":"https://api.github.com/users/sstephenson/followers","following_url":"https://api.github.com/users/sstephenson/following{/other_user}","gists_url":"https://api.github.com/users/sstephenson/gists{/gist_id}","starred_url":"https://api.github.com/users/sstephenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstephenson/subscriptions","organizations_url":"https://api.github.com/users/sstephenson/orgs","repos_url":"https://api.github.com/users/sstephenson/repos","events_url":"https://api.github.com/users/sstephenson/events{/privacy}","received_events_url":"https://api.github.com/users/sstephenson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2011-08-05T14:55:12Z","updated_at":"2015-09-15T18:56:47Z","closed_at":"2011-08-05T15:14:35Z","body":"     -S             Makes Ruby use the PATH environment variable to search for\r\n                    script, unless if its name begins with a slash.  This is\r\n                    used to emulate #! on machines that don't support it, in\r\n                    the following manner:\r\n\r\n                          #! /usr/local/bin/ruby\r\n                          # This line makes the next one a comment in Ruby \\\r\n                            exec /usr/local/bin/ruby -S $0 $*\r\n\r\nWhen you pass the `-S foo` flag to Ruby, it finds `foo` in `$PATH`, then scans the first line of the file to see if it's a Ruby program and re-execs: https://github.com/ruby/ruby/blob/trunk/ruby.c#L1549-1562\r\n\r\nThe Rubinius installer uses this:\r\n\r\n    /Users/sam/.rbenv/versions/1.9.3-preview1/bin/ruby -S rake  -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/config.rb -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/rakelib/ext_helper.rb -r /private/tmp/ruby-build.10166-13998/rubinius-1.2.4/rakelib/dependency_grapher.rb build:mri\r\n    /Users/sam/.rbenv/versions/1.9.3-preview1/bin/ruby: no Ruby script found in input (LoadError)\r\n    rake aborted!\r\n    Command failed with status (1): [/Users/sam/.rbenv/versions/1.9.3-preview1/...]\r\n\r\nOne workaround would be to change our shims' shebang to point to another shim in our libexec directory with `ruby` in the name.  \r\n\r\nAnother workaround would be for `rbenv-exec` to prepend `$PATH` with the current version's prefix, so that children of any Ruby process will find the actual binaries in the path before our shims. The downside here is that you wouldn't be able to modify `RBENV_VERSION` in a Ruby process to spawn a child with a different version, though I'm not sure that's actually useful."},"comment":{"url":"https://api.github.com/repos/sstephenson/rbenv/issues/comments/140500116","html_url":"https://github.com/sstephenson/rbenv/issues/14#issuecomment-140500116","issue_url":"https://api.github.com/repos/sstephenson/rbenv/issues/14","id":140500116,"user":{"login":"zenspider","id":9832,"avatar_url":"https://avatars.githubusercontent.com/u/9832?v=3","gravatar_id":"","url":"https://api.github.com/users/zenspider","html_url":"https://github.com/zenspider","followers_url":"https://api.github.com/users/zenspider/followers","following_url":"https://api.github.com/users/zenspider/following{/other_user}","gists_url":"https://api.github.com/users/zenspider/gists{/gist_id}","starred_url":"https://api.github.com/users/zenspider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zenspider/subscriptions","organizations_url":"https://api.github.com/users/zenspider/orgs","repos_url":"https://api.github.com/users/zenspider/repos","events_url":"https://api.github.com/users/zenspider/events{/privacy}","received_events_url":"https://api.github.com/users/zenspider/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T18:56:47Z","updated_at":"2015-09-15T18:56:47Z","body":"The ruby in question is literally: `sh Gem.ruby, \"-S\", \"gem\", \"push\", g` (where `g` is the path of the gem to push)."}}