Command line arguments ignored when RUBYOPT is set
--------------------------------------------------
Key: JRUBY-3962
URL: http://jira.codehaus.org/browse/JRUBY-3962
Project: JRuby
Issue Type: Bug
Components: Miscellaneous
Affects Versions: JRuby 1.4
Environment: Linux
Reporter: Choi, Junegunn
Priority: Minor
When RUBYOPT environment variable is set, command line arguments are ignored as
follows.
> export RUBYOPT=rubygems
> jruby -e 'p ARGV' a b c
[]
> unset RUBYOPT
> jruby -e 'p ARGV' a b c
["a", "b", "c"]
This seems like a bug to me. I looked into the code and found that
ArgumentProcessor.processArguments is called twice when "RUBYOPT" is set,
and it does not preserve the arguments previously processed by the first call.
A simple patch.
diff --git a/src/org/jruby/RubyInstanceConfig.java
b/src/org/jruby/RubyInstanceConfig.java
index cd1259d..95e0232 100644
--- a/src/org/jruby/RubyInstanceConfig.java
+++ b/src/org/jruby/RubyInstanceConfig.java
@@ -758,6 +758,7 @@ public class RubyInstanceConfig {
}
// Remaining arguments are for the script itself
+ for (String arg : argv) arglist.add(arg);
argv = arglist.toArray(new String[arglist.size()]);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email