[Rubygems-developers] Reduce the gap between posix and Windows

Luis Lavena luislavena at gmail.com
Fri Apr 25 08:09:55 EDT 2008


On Fri, Apr 25, 2008 at 8:58 AM, James Tucker <jftucker at gmail.com> wrote:
> >
> > A better look at this make me think is better send this to ruby-core
> > and get this fixed instead. What current Ruby is doing doesn't work as
> > expected, at least not in Windows.
> >
> > I'll try create a small example and provide a patch to ruby-core.
> >
>
>
>  assoc .=MaybeExecutable
>  ftype MaybeExecutable=c:\ruby\bin\ruby c:\pretend_posix\bin\execve %0 %*
>  set PATHEXT=.;%PATHEXT%
>
>  Or something like that. N.B. I got most of the way to the above working,
> and hit some problems (I was working off a network drive at the time, YMMV
> with more local drives, hopefully, the solution can work).
>
>  Also, git solved this problem by implementing some compatibility wrappers:
>
>  http://marc.info/?l=git&m=120413867221197&w=2
>

Well, what actually Git do is wrap the environment of msys around the
batch file to avoid having it in the PATH.

What we are facing is another problem here.

RubyGems generated 2 files for each executable script that is
installed, example:

rake
rake.bat

spec
spec.bat

When Ruby is doing lookup (dln_find_exe) it consider the first it
finds (rake) to be an executable, and not the later. Then it fails to
use cmd.exe to fire the script and that ended you with borked results.

In any case, Nobu committed a change in the lookup process that solved
this, so now is possible do system('rake') without worry about
platforms, .bat, .cmd or all that.

>  And the details of the Windows rules, at least CMD rules for launching apps
> are in some more detail here:
>
>
> http://www.microsoft.com/technet/archive/winntas/deploy/prodspecs/shellscr.mspx?mfr=true
>

Again, the problem wasn't cmd launching the file, but Ruby picking the
ruby script instead of the stub one.

-- 
Luis Lavena
Multimedia systems
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams


More information about the Rubygems-developers mailing list