On Aug 2 16:50, Corinna Vinschen wrote: > On Aug 2 13:55, Corinna Vinschen wrote: > > [Moving this discussion to cygwin-developers] > > On Jul 31 10:10, Corinna Vinschen wrote: > > > On Jul 30 19:04, Ken Brown via Cygwin wrote: > > > > On 7/30/2020 1:17 PM, Corinna Vinschen wrote: > > > > > On Jul 30 13:59, Corinna Vinschen wrote: > > > > > > On Jul 29 19:12, Ken Brown via Cygwin wrote: > > > > > > > On 7/29/2020 4:17 PM, Ken Brown via Cygwin wrote: > > > > > > > > posix_spawn(p) returns before the spawned process is fully up and > > > > > > > > running.  [...] > > > > > > > I just took a look at the source, and I see that posix_spawn > > > > > > > was taken from FreeBSD. > > > > > > > [...] > > > > > > > > > > > > Actually, this is a Cygwin problem. > > > > > > [...] > > > > > > IOW, we need a Cygwin-specific do_posix_spawn() using fork(2) > > > > > > in conjunction with some synchronization the BSD function > > > > > > gets "for free" by using its specific vfork(2). > > > > > > > > > > Below is a POC implementation for a Cygwin-specific do_posix_spawn(). > > > > > [...] > > > > > Can you give it a try? > > > > > > > > It looks like something further is needed: 'wait' doesn't seem to recognize > > > > the spawned process. > > > > > > Oh well. > > > [...] > > > > I attached another patch. This one is designed from the ground up and > > I *think* it works as desired. I added lots of comments so the idea > > behind this patch should be clear enough. > > > > Please give it a try. > > Version 2 [...] Version 3. The additional synchronization step can go away and the code simplified quite a bit by providing a fork replacement returning the child's process handle. I hope this is the last version of the patch :} Corinna