Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor argument handling in jruby.bash start script for the JRuby interpreter #3384

Closed
nelsnelson opened this issue Oct 10, 2015 · 7 comments
Closed

Comments

@nelsnelson
Copy link

This sort of error should be handled more gracefully, I think.

$ jruby -version
jruby 9.0.1.0 (2.2.2) 2015-09-02 583f336 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]
NameError: undefined local variable or method `rsion' for main:Object
  <top> at -e:1
@nirvdrum
Copy link
Contributor

That's a tricky one. We do what MRI does:

> ruby -version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)

@nirvdrum
Copy link
Contributor

To be clear, what's happening is the -v flag is recognized, followed by the -e flag, followed by the argument to the -e flag, which in this case is "rsion". "rsion" is evaluated as an inline script and you end up getting the error about the undefined local variable.

@nelsnelson
Copy link
Author

:+1 @nirvdrum

@nelsnelson
Copy link
Author

Ah, I see. Well, if MRI does it then, nevermind.

@nirvdrum
Copy link
Contributor

FWIW, I do agree it could be more friendly. It'd probably be best to take it up with the MRI tracker and see if gets accepted there.

@enebo
Copy link
Member

enebo commented Oct 10, 2015

module Kernel
  def rsion
     org.jruby.util.cli.OutputStrings.get_version_string
  end
end

@enebo
Copy link
Member

enebo commented Oct 10, 2015

(This was a joke)

@enebo enebo added this to the Invalid or Duplicate milestone Oct 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants