Charlie and I were talking about this email yesterday afternoon and
we were hoping to not have those system-dependent callouts/heuristics in here.
The other solution we thought of was passing an env string in as
a system property (then jruby.bat and jruby.sh would need to be
updated to provide this). This also should be more friendly to
embedders who do not want to external call to get env (much less let
anyone see it).
No solution sounds wonderful. Is the above solution better or
worse than the original proprosed solutions?
-Tom
On Sat, 04 Feb 2006, David Corbin defenestrated me:
> On Thursday 02 February 2006 05:36 pm, Tim Azzopardi wrote:
> > While testing the AntBuilder stuff, I found that ENV['RUBY_HOME'] is nil in
> > jruby but works in cruby. (There is only one environment variable that
> > works in jruby which is HOME because of a specific bit of code.)
> >
> > I had a go at fixing this initially using System.getenv() which returned a
> > hashmap of all the envonment variables. This was great until I realized it
> > was a Java5 feature.
> >
> > Having googled around a bit, I see that everyone has the same problem and
> > that pre java5 you need to drop out to the OS with
> > Runtime.getRuntime().exec("env"|"set") and parse the output.
> >
> > So I am happy to give this Runtime.exec("env"|"set") technique a go, if one
> > of you core jruby guys thinks its the right direction to go in.
> > ___________Is_the_right_direction___________? If not, I'll just drop it.
> >
>
> I think it's a reasonable direction, but I encourage you to reflectively call
> System.getEnv if you ARE on Java5. That is, have two ENV "loaders", and
> choose which one based on Java version.
>
> > If it is the right direction to go in, then I see a couple of basic ways to
> > implement:
> >
> > (a) from scratch, copy and or get inspiration from what look like many
> > "public domain" Runtime.exec solutions such as
> > http://www.rgagnon.com/javadetails/java-0150.html
> >
> > (b) Put ant.jar on the jruby classpath and call org.apache....Execute
> > getProcEnvironment() (which is a comprehensive Runtime..exec solution too).
> >
> > (c) Get inspiration from org.apache...Execute. (Presumably can't be copied
> > to jruby because of ASL2 license? Sigh...
> >
>
> Definately (a). Also, you should be sure to do this only once, and cache the
> results. And watch out for synchronization issues.
>
> > Aside number 1:
> > I can see that there is potential conflict/confusion between the
> > linux:env/windows:set namespace and the java System.getProperty()
> > namespace. Maybe the two namespaces can simply be combined in the ruby ENV
> > hash? Maybe a seperate jrurby specific global is required for the java
> > System.getProperty() namespace: ENV_JAVA or ENV_JRUBY or something.
>
> The two spaces should remain seperate entirely, if possible.
>
> > Aside number 2:
> > I wasn't intending to do anything about either of these comments in the
> > code related to the ENV global :
> > // TODO: ENV Not really a RubyHash (but close)
> > // TODO: ENV Should not copy system props, but should reference them
> > instead This seems like a seperate issue.
>
> Well, the second one will "go away", I think, won't it?
>
> > And finally, sorry if this an annoying low priority distraction from the
> > hard core stuff going on at the moment.
>
> It all needs to be done...
>
> >
> > Cheers all
> > Tim
> >
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > files for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> > _______________________________________________
> > Jruby-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jruby-devel
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Jruby-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jruby-devel
--
+ http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+
| Thomas E Enebo, Protagonist | "Luck favors the prepared |
| | mind." -Louis Pasteur |
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel