* sigproc.cc (child_info::sync): Move check for !wr_proc_pipe lower.
* spawn.cc (spawn_guts): Correct check for top-level process.
This commit is contained in:
parent
fece95f7f3
commit
0cdcb2345a
@ -819,41 +819,36 @@ bool
|
|||||||
child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong)
|
child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong)
|
||||||
{
|
{
|
||||||
bool res;
|
bool res;
|
||||||
if (!subproc_ready && !myself->wr_proc_pipe)
|
HANDLE w4[2];
|
||||||
res = false;
|
unsigned n = 0;
|
||||||
|
unsigned nsubproc_ready;
|
||||||
|
|
||||||
|
if (!subproc_ready)
|
||||||
|
nsubproc_ready = WAIT_OBJECT_0 + 3;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HANDLE w4[2];
|
w4[n++] = subproc_ready;
|
||||||
unsigned n = 0;
|
nsubproc_ready = 0;
|
||||||
unsigned nsubproc_ready;
|
}
|
||||||
|
w4[n++] = hProcess;
|
||||||
|
|
||||||
if (!subproc_ready)
|
sigproc_printf ("n %d, waiting for subproc_ready(%p) and child process(%p)", n, w4[0], w4[1]);
|
||||||
nsubproc_ready = WAIT_OBJECT_0 + 3;
|
DWORD x = WaitForMultipleObjects (n, w4, FALSE, howlong);
|
||||||
else
|
x -= WAIT_OBJECT_0;
|
||||||
|
if (x >= n)
|
||||||
|
{
|
||||||
|
system_printf ("wait failed, pid %d, %E", pid);
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type == _PROC_EXEC && x == nsubproc_ready && myself->wr_proc_pipe)
|
||||||
{
|
{
|
||||||
w4[n++] = subproc_ready;
|
ForceCloseHandle1 (hProcess, childhProcess);
|
||||||
nsubproc_ready = 0;
|
hProcess = NULL;
|
||||||
}
|
|
||||||
w4[n++] = hProcess;
|
|
||||||
|
|
||||||
sigproc_printf ("n %d, waiting for subproc_ready(%p) and child process(%p)", n, w4[0], w4[1]);
|
|
||||||
DWORD x = WaitForMultipleObjects (n, w4, FALSE, howlong);
|
|
||||||
x -= WAIT_OBJECT_0;
|
|
||||||
if (x >= n)
|
|
||||||
{
|
|
||||||
system_printf ("wait failed, pid %d, %E", pid);
|
|
||||||
res = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (type == _PROC_EXEC && x == nsubproc_ready)
|
|
||||||
{
|
|
||||||
ForceCloseHandle1 (hProcess, childhProcess);
|
|
||||||
hProcess = NULL;
|
|
||||||
}
|
|
||||||
sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x);
|
|
||||||
res = true;
|
|
||||||
}
|
}
|
||||||
|
sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x);
|
||||||
|
res = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -815,7 +815,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
{
|
{
|
||||||
case _P_OVERLAY:
|
case _P_OVERLAY:
|
||||||
myself.hProcess = pi.hProcess;
|
myself.hProcess = pi.hProcess;
|
||||||
if (!synced && !myself->wr_proc_pipe)
|
if (synced && !myself->wr_proc_pipe)
|
||||||
{
|
{
|
||||||
extern bool is_toplevel_proc;
|
extern bool is_toplevel_proc;
|
||||||
is_toplevel_proc = true;
|
is_toplevel_proc = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user