This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: spawn and wait?


Hi Tim,

it's not a bug. Try the following:
 
   #include <stdio.h>
   #include <stdlib.h>
   #include <process.h>
 
   int main()
   {
       int stat, pid;
 
       pid = spawnl(_P_NOWAIT, 
           "/gnuwin32/b18/H-i386-cygwin32/bin/sleep.exe", "sleep", "5", 0);
       printf("spawned (%d).  waiting\n", stat);
       cwait(&stat, pid, WAIT_CHILD);
       printf("status %x\n", stat);
       exit (0);
   }
  
and you should something like the following (if the spwan is successful):
    
   spawned (xx).  waiting
   status 0

where "xx" is the pid.
 
fyi, wait goes with [fork]+exec*, and cwait goes with spawn*.

Regards,
Mumit - khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]