* spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to make sure
that a stub process does not keep the current working directory busy after the "execed" process has exited.
This commit is contained in:
parent
9a0b76dced
commit
c75e4f09ec
|
@ -1,3 +1,9 @@
|
||||||
|
2005-01-22 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to
|
||||||
|
make sure that a stub process does not keep the current working
|
||||||
|
directory busy after the "execed" process has exited.
|
||||||
|
|
||||||
2005-01-22 Christopher Faylor <cgf@timesys.com>
|
2005-01-22 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out
|
* pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out
|
||||||
|
|
|
@ -138,18 +138,20 @@ pinfo::exit (DWORD n)
|
||||||
fill_rusage (&r, hMainProc);
|
fill_rusage (&r, hMainProc);
|
||||||
add_rusage (&self->rusage_self, &r);
|
add_rusage (&self->rusage_self, &r);
|
||||||
|
|
||||||
/* The below call could be moved down two lines, but I like to see consistent
|
/* The below call could be moved down two lines, but this provides consistent
|
||||||
output from strace and the overhead should be extremely negligible. */
|
output from strace and the overhead should be extremely negligible. */
|
||||||
maybe_set_exit_code_from_windows ();
|
maybe_set_exit_code_from_windows ();
|
||||||
|
|
||||||
|
|
||||||
if (n != EXITCODE_NOSET)
|
if (n != EXITCODE_NOSET)
|
||||||
{
|
{
|
||||||
/* Move to an innocuous location to avoid races with other processes
|
SetCurrentDirectory ("c:\\"); /* Move to an innocuous location to
|
||||||
that may want to manipulate the current directory before this process
|
avoid races with other processes
|
||||||
|
that may want to manipulate the
|
||||||
|
current directory before this process
|
||||||
has completely exited. */
|
has completely exited. */
|
||||||
SetCurrentDirectory ("c:\\");
|
self->alert_parent (0); /* Shave a little time by telling our
|
||||||
/* Shave a little time off by telling our parent that we have now
|
parent that we have now exited. */
|
||||||
exited. */
|
|
||||||
self->alert_parent (0);
|
|
||||||
}
|
}
|
||||||
int exitcode = self->exitcode;
|
int exitcode = self->exitcode;
|
||||||
release ();
|
release ();
|
||||||
|
|
|
@ -809,9 +809,14 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
dup_proc_pipe essentially a no-op. */
|
dup_proc_pipe essentially a no-op. */
|
||||||
if (myself->wr_proc_pipe)
|
if (myself->wr_proc_pipe)
|
||||||
{
|
{
|
||||||
/* Make sure that we own wr_proc_pipe just in case we've been
|
myself->sync_proc_pipe (); /* Make sure that we own wr_proc_pipe
|
||||||
previously execed. */
|
just in case we've been previously
|
||||||
myself->sync_proc_pipe ();
|
execed. */
|
||||||
|
SetCurrentDirectory ("c:\\"); /* Move to an innocuous location to
|
||||||
|
avoid races with other processes
|
||||||
|
that may want to manipulate the
|
||||||
|
current directory before this process
|
||||||
|
has completely exited. */
|
||||||
(void) myself->dup_proc_pipe (pi.hProcess);
|
(void) myself->dup_proc_pipe (pi.hProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue