Writing ENV[]= changes through to the real ENV (via POSIX) should be
configurable per runtime
---------------------------------------------------------------------------------------------
Key: JRUBY-5934
URL: https://jira.codehaus.org/browse/JRUBY-5934
Project: JRuby
Issue Type: New Feature
Affects Versions: JRuby 1.6.3
Reporter: Tobias Crawley
Assignee: Thomas E Enebo
Currently, any changes to ENV in any runtime get reflected in the real ENV.
This isn't always desirable, especially in the case of embedded runtimes. I
propose a per runtime setting or System property to disable this.
I would be happy to implement this if the jruby team agrees that it would be
useful.
My current approach to disable this is:
{code}
StringBuffer env_fix = new StringBuffer( "require 'java'" );
env_fix.append( "update_real_env_attr =
org.jruby.RubyGlobal::StringOnlyRubyHash.java_class.declared_fields.find { |f|
f.name == 'updateRealENV' }\n" );
env_fix.append( "update_real_env_attr.accessible = true\n" );
env_fix.append( "update_real_env_attr.set_value(ENV.to_java, false)\n" );
runtime.evalScriptlet( env_fix.toString() );
{code}
And god bless JRuby for making even that so flippin' easy.
--
This message is automatically generated by JIRA.
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