In article <m2r8r5j8ka.fsf / zip.local.thomases.com>,
  Dave Thomas <Dave / PragmaticProgrammer.com> writes:

> Many thanks for the patches. These are exactly the kinds of things we
> need.

Hm.  

> > * Bourne shell doesn't exec last command.

Now my patch for this problem is guarded by Solaris.only.  But this is
not Solaris specific.  I know only two shells which exec last command
of an option argument of -c: bash and zsh.  So, now, the test is
failed on other than Linux, MacOS X and Solaris, I think.  I suggest
simply rip off the guard because it doesn't depend to ruby behaviour.

The difference depends to the behaviour of /bin/sh.

  pipe = IO.popen("#$interpreter -e 'p $$'", "r")
  assert_equal(pid.to_i, pipe.pid)

When a ruby prosess interprets above code, it uses rb_proc_exec to
create a child process.  Since the command line has shell meta
characters such as "'" and "$", rb_proc_exec uses /bin/sh to interpret
it and pipe.pid becomes a process id of /bin/sh.  Then /bin/sh
interprets it and runs $interpreter.  In general, /bin/sh runs
$interpreter using fork and exec.  But bash and zsh directly exec
$interpreter.  $interpreter -e 'p $$' reports its process id but it
may be a process id of grandchild or child of the ruby process.

If you want to try test /bin/sh is bash or zsh, the code is right.
But I think it is not intended.

My patch prepends 'exec' for the command line always to force exec
$interpreter directly.  Since it works with bash or zsh, the guard is
not required.
-- 
Tanaka Akira