www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/12/29/23:21:04

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: spawn and wait?
29 Dec 1997 23:21:04 -0800 :
Message-ID: <9712300646.AA24720.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <m0xmnJa-00110YC AT malasada DOT lava DOT net>
To: newsham AT lava DOT net (Tim Newsham)
Cc: gnu-win32 AT cygnus DOT com

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 AT xraylith DOT wisc DOT edu
http://www.xraylith.wisc.edu/~khan/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019