[jruby-user] Re: rescue error?
"Jabari Z." <[email protected]> Sat, 21 Mar 2015 17:13:00 +0100
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <[email protected]> |
Hey Keith, thanks.
Doing something like this:
if system('which factor'); puts 'Yes factor' else 'No factor' end
is much cleaner and transportable.
I tested it on my system with MIR (1.8.7, 2.1.2, 2.2.1), JRuby-1.7.19
and Rubinius-2.5.2, and there were no problems. I'll try it later on my
Win7 system with Rubyinstaller rubies.
FYI, I started out using the RUBY_PLATFORM value to check against, but
soon realized I would have to know if 'factor' runs on all the possible
ruby platforms to make if universally transportable, so I started
checking directly for 'factor' being on a platform. In Unix 'factor' has
been standard since 1974, and in Linux and BSD since their inception, so
I'm not too concerned about possible false positives on other platforms.
https://en.wikipedia.org/wiki/Factor_(Unix)
The still open question, though, is JRuby's non-conformist to MRI
behavior handling rescue in the original example. This can obviously
have catastrophic consequences for people expecting their MRI code to
operate the same on JRuby.
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email