On 14 September 2011 21:06, Phillip Gawlowski <cmdjackryan / gmail.com> wrote:
> On Wed, Sep 14, 2011 at 8:56 PM, Michal Suchanek <hramrach / centrum.cz> wrote:
>>
>> Obviously because I can't be sure that the interpreter *is* in the
>> place it was installed.
>>
>> Is that too hard to understand?
>
> Why would you *care* where it is installed?
>
> IOW: What's the problem you are actually trying to solve?
>

I don't care where it is *installed*, I care where it *is*.

The reason is quite simple and i said it in the first mail. I was
trying to write a test for a function that redirects STDERR.

Now I have a library of functions already tested that redirects
everything but it runs a command with STD I/O/E redirected, not ruby.

AFAICT it is not possible to pass a "-" into exec to have ruby
re-executed, and exec is what I use.

So to write the test I have to use fork and do manual redirections to
check that the function works as I want.

It would be much easier if I could just run Ruby and pass it a test
program as argument.

Now I am running this on Linux so there is not much point in moving
the Ruby interpreter. There are often symlinks but the path under
which Ruby was originally installed would usually work, and I don't
run the test during Ruby installation.

Also exec is not portable to Windows so I need not worry about that.

On the other hand, OS X can run Ruby, has exec() and has linker
support for moving whole applications with libraries and all. I am not
sure how much Ruby would break by installing in this fashion, though.

So maybe I was looking for solution needlessly general because I did
not consider the consequences of config not being enough. I guess
there are other things that would break if it weren't.

There were people trying to install their Ruby application from a CD
and for those config would not be enough but $0 and knowledge of their
CD layout should suffice.

Thanks

Michal