"Eric Hodel" <drbrain / segment7.net> wrote in message 
news:9379782E-03F1-4272-91BD-A6725FB78988 / segment7.net...
> On Jul 14, 2006, at 10:41 PM, Just Another Victim of the Ambient  Morality 
> wrote:
>>
>> Of course, in DOS, the command line uses the ">" symbol but I  didn't 
>> want to create any confusion with quoted text.  Of course,  the solution 
>> was to use the "system" method but, really, what's so  different with the 
>> familiar `` operator?
>
> Are you sure it worked with system?
>
> try:
>
> $ ruby -e 'p system("./x.pl")'
>
> You should see a hi and a true printed, something like this:
>
> hi
> true
>
> The differences between ` and system shouldn't be important for  getting 
> this to work, I think Windows needs to know how to run .pl  files for this 
> to work.

    Ah, indeed, system didn't work.  Windows does know how to execute PERL 
files so this behaviour is curious...


>> ...Yet you didn't know this nor did you use it in your example.   This 
>> suggests to me that you don't use this operator anymore.  Why  not?
>
> I could have used `, but chose not to.  I use ` when I need to  capture 
> stdout.

    Is it faster not to capture output if you don't need it?


>> The "system" call doesn't even return the output of the command nor  does 
>> this output actually reach stdout...
>
> Well, it may not be running at all and returning false.

    This is, in fact, the case.  The following works:

ruby -e 'system "perl x.pl"'

    ...which, again, shows that Ruby (or Windows) can search execution paths 
for things to execute.  It seems clear that something, somewhere, is having 
trouble associating .pl files to the PERL interpreter.  Indeed, simply 
executing "x" (without the extension) on the command line doesn't work, so 
this might show evidence of that.  However, if x were a ruby script, 
executing that on the command line _would_ work!  Yet, it won't if passed to 
the "system" method, even if we were to add the extension.  So, something is 
quite different between the command line and the Ruby "system" method...


> Do you have Windows mapping the perl interpreter to .pl files?  What 
> happens when you double-click a .pl file from explorer?

    It launches a DOS command window with the script executing...


> A Windows expert may need to help you on this problem.  Ruby just  asks 
> the OS to run these things, so if the OS can't figure out what  to do with 
> it Ruby won't be able to either. :(

    I think you may be right.  This looks like it's either a peculiarity of 
MS Windows or of the Win32 implementation of Ruby...
    Thanks for your input!