This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: ming exec forks ???
- To: Keraba <keraba at yahoo dot com>
- Subject: Re: ming exec forks ???
- From: Mumit Khan <khan at NanoTech dot Wisc dot EDU>
- Date: Thu, 02 Dec 1999 20:16:30 -0600
- cc: cygwin at sourceware dot cygnus dot com
Keraba <keraba@yahoo.com> writes:
> Hi,
>
> I'm having trouble with the execv() system call. With the Cygwin
> gcc and libraries it works fine, but with the Ming equivalents
> it acts more like fork(), spawning off a child then continuing,
> without waiting for the child to die first.
I don't know what the problem is, but under windows, you probably
want _spawnv[pe] instead. Go to MS web site and search the docs
-- it's all online.
>
> I'm sorry, I'd write to the ming-gcc list if I knew of one.
http://www.egroups.com/lists/mingw32/
Here's a trivial example:
/*
* spawn test:
*/
#include <stdio.h>
#include <process.h>
int
main ()
{
char *argv[3];
int retcode;
/* Set up argv */
argv[0] = "ls";
argv[1] = "-l";
argv[2] = NULL;
fprintf (stderr, "Spawing child: %s\n", argv[0]);
retcode = _spawnvp (_P_WAIT, argv[0], argv);
if (retcode == -1)
perror (argv[0]);
fprintf (stderr, "Child done: retcode = %d\n", retcode);
return 0;
}
Regards,
Mumit
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com