* pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Make sure that process

has exited before getting an error code.
(pinfo::exit): "cd" to innocuous location before exiting to make sure that
process does not keep the current working directory busy while it is in the
process of really exiting.
This commit is contained in:
Christopher Faylor 2005-01-22 18:07:10 +00:00
parent f2d6aeea17
commit 4c133af135
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2005-01-22 Christopher Faylor <cgf@timesys.com>
* pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Make sure that
process has exited before getting an error code.
(pinfo::exit): "cd" to innocuous location before exiting to make sure
that process does not keep the current working directory busy while it
is in the process of really exiting.
2005-01-18 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (CoInitialize): Remove.

View File

@ -111,6 +111,9 @@ pinfo::maybe_set_exit_code_from_windows ()
DWORD oexitcode = self->exitcode;
if (hProcess && !(self->exitcode & EXITCODE_SET))
{
WaitForSingleObject (hProcess, INFINITE); // just to be safe, in case
// process hasn't quite exited
// after closing pipe
GetExitCodeProcess (hProcess, &x);
self->exitcode = EXITCODE_SET | (x & 0xff) << 8;
}
@ -137,7 +140,10 @@ pinfo::exit (DWORD n)
maybe_set_exit_code_from_windows ();
if (n != EXITCODE_NOSET)
self->alert_parent (0);
{
SetCurrentDirectory ("c:\\");
self->alert_parent (0);
}
int exitcode = self->exitcode;
release ();