This is the mail archive of the
mailing list for the Cygwin project.
Re: cygwin 1.5.11: execv doesn't set argv on Windows programs
On Fri, 10 Sep 2004, Christopher Faylor wrote:
> On Fri, Sep 10, 2004 at 12:38:31AM -0400, Igor Pechtchanski wrote:
> >I'm getting the following behavior consistently:
> >In other words, invoking a Cygwin program sets argv correctly, but
> >invoking a Windows program doesn't. Interestingly enough, using the MinGW
> >execv works properly:
> There is no such thing as "argv" for a Windows program. Cygwin uses
> CreateProcess to create processes. CreateProcess does not have the concept
> of "argv". Perhaps Microsoft's exec functions do something funky that
> is understood by other msvcrt programs. Cygwin doesn't do that.
Allow me to disagree. CreateProcess takes two separate arguments: the
image to run, and the command line (yes, as one long line). The actual
executable being run is the image parameter, but the value of argv is
extracted from the command line one (well, unless the image name is NULL,
in which case the image name and argv are the same). That's the value
of argv that I meant.
Now, spawn_guts() *seems* to retain the original (correct) argv when
constructing the command line string, but it apparently replaces it with
the prog_arg parameter somewhere for Windows programs...
Hmm, wait a minute, now that I phrased it this way, I think it enabled me
to find the culprit. Lines 513-515 of spawn.cc say:
/* Replace argv with the full path to the script if this is the
first time through the loop. */
Is there a particular reason why this is done for ".exe" files?
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing." -- Dr. Jubal Harshaw
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html