Determining ruby interpreter

anything more reliable than this?

   ~ > ruby -rrbconfig -e'p
File.join(*Config::CONFIG.values_at("bindir","RUBY_INSTALL_NAME"))'
  "/usr/local/bin/ruby"

Works on windows and cygwin, but you might have to add ".exe" to spawn
an external process.

really? the install name doesn't include the extention then?

thanks for the check.

-a

···

On Fri, 20 Aug 2004, Mehr, Assaph (Assaph) wrote:

anything more reliable than this?

   ~ > ruby -rrbconfig -e'p
File.join(*Config::CONFIG.values_at("bindir","RUBY_INSTALL_NAME"))'
  "/usr/local/bin/ruby"

Works on windows and cygwin, but you might have to add ".exe" to spawn
an external process.

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================

This works reliably to get the full path to the interpreter on both *nix and
Win platforms:

ruby = File.join(::Config::CONFIG['bindir'],
                 ::Config::CONFIG['ruby_install_name'])
ruby << ::Config::CONFIG['EXEEXT'

Kirk Haines

···

On Fri, 20 Aug 2004 13:01:02 +0900, Ara.T.Howard wrote

really? the install name doesn't include the extention then?

thanks for the check.

Hi,

At Fri, 20 Aug 2004 13:01:02 +0900,
Ara.T.Howard wrote in [ruby-talk:109940]:

>> anything more reliable than this?
>
>> ~ > ruby -rrbconfig -e'p
>> File.join(*Config::CONFIG.values_at("bindir","RUBY_INSTALL_NAME"))'
>> "/usr/local/bin/ruby"
>
> Works on windows and cygwin, but you might have to add ".exe" to spawn
> an external process.

really? the install name doesn't include the extention then?

It doesn't, but EXEEXT is not needed by system and spawn.

···

--
Nobu Nakada

When cut-and-pastes Got Wrong. Next on Fox. That should have been:

ruby = File.join(::Config::CONFIG['bindir'],
                 ::Config::CONFIG['ruby_install_name'])
ruby << ::Config::CONFIG['EXEEXT']

Kirk Haines

tricky. what is spawn?!

does this do anything tricky on windows like it does on *nix:

   system "#{ cmd } 2>/dev/null"

??

-a

···

On Fri, 20 Aug 2004 nobu.nokada@softhome.net wrote:

Hi,

At Fri, 20 Aug 2004 13:01:02 +0900,
Ara.T.Howard wrote in [ruby-talk:109940]:

anything more reliable than this?

   ~ > ruby -rrbconfig -e'p
File.join(*Config::CONFIG.values_at("bindir","RUBY_INSTALL_NAME"))'
  "/usr/local/bin/ruby"

Works on windows and cygwin, but you might have to add ".exe" to spawn
an external process.

really? the install name doesn't include the extention then?

It doesn't, but EXEEXT is not needed by system and spawn.

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================

Hi,

At Fri, 20 Aug 2004 23:45:50 +0900,
Ara.T.Howard wrote in [ruby-talk:109977]:

>>> Works on windows and cygwin, but you might have to add ".exe" to spawn
>>> an external process.
>>
>> really? the install name doesn't include the extention then?
>
> It doesn't, but EXEEXT is not needed by system and spawn.

tricky. what is spawn?!

As well as command.com/cmd.exe, some suffixes can be omitted.

does this do anything tricky on windows like it does on *nix:

   system "#{ cmd } 2>/dev/null"

It would work except that:
* redirection with file descriptor works only on cmd.exe, but
  not command.com, and
* /dev/null doesn't exist on Windows.

···

--
Nobu Nakada

<snip>

* /dev/null doesn't exist on Windows.

I believe it exists (not sure if on *ALL* versions) as
"NUL". Notice that it is spelt with a single L

Try this :

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>mkdir junk_nobu

C:\>cd junk_nobu

C:\junk_nobu>dir
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\junk_nobu

08/20/2004 05:04p <DIR> .
08/20/2004 05:04p <DIR> ..
               0 File(s) 0 bytes
               2 Dir(s) 35,783,368,704 bytes free

C:\junk_nobu>dir > null

C:\junk_nobu>dir
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\junk_nobu

08/20/2004 05:04p <DIR> .
08/20/2004 05:04p <DIR> ..
08/20/2004 05:04p 326 null
               1 File(s) 326 bytes
               2 Dir(s) 35,783,368,704 bytes free

C:\junk_nobu>dir > NUL

C:\junk_nobu>dir
Volume in drive C is LOCAL
Volume Serial Number is AC53-D8CC

Directory of C:\junk_nobu

08/20/2004 05:04p <DIR> .
08/20/2004 05:04p <DIR> ..
08/20/2004 05:04p 326 null
               1 File(s) 326 bytes
               2 Dir(s) 35,783,368,704 bytes free

C:\junk_nobu>

···

--- nobu.nokada@softhome.net wrote:

_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush