Updates to pg_regress.c
Started by Magnus Haganderover 19 years ago2 messages
Found a couple of "XXX is there a way to do this on Windows" in
pg_regress.c that I had missed. The answer to the question is yes,
attached is a patch that does it.
//Magnus
Attachments:
pg_regress.diffapplication/octet-stream; name=pg_regress.diffDownload
Index: src/test/regress/pg_regress.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress.c,v
retrieving revision 1.21
diff -c -r1.21 pg_regress.c
*** src/test/regress/pg_regress.c 19 Sep 2006 15:36:08 -0000 1.21
--- src/test/regress/pg_regress.c 24 Sep 2006 15:18:58 -0000
***************
*** 615,621 ****
/*
* Spawn a process to execute the given shell command; don't wait for it
*
! * Returns the process ID so we can wait for it later
*/
static PID_TYPE
spawn_process(const char *cmdline)
--- 615,621 ----
/*
* Spawn a process to execute the given shell command; don't wait for it
*
! * Returns the process ID so we can wait for it later. On win32, return HANDLE.
*/
static PID_TYPE
spawn_process(const char *cmdline)
***************
*** 1541,1556 ****
/*
* Fail immediately if postmaster has exited
- *
- * XXX is there a way to do this on Windows?
*/
#ifndef WIN32
if (kill(postmaster_pid, 0) != 0)
{
fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
exit_nicely(2);
}
- #endif
pg_usleep(1000000L);
}
--- 1541,1556 ----
/*
* Fail immediately if postmaster has exited
*/
#ifndef WIN32
if (kill(postmaster_pid, 0) != 0)
+ #else
+ if (WaitForSingleObject(postmaster_pid, 0) == WAIT_OBJECT_0)
+ #endif
{
fprintf(stderr, _("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
exit_nicely(2);
}
pg_usleep(1000000L);
}
***************
*** 1563,1576 ****
* in startup. Try to kill it ungracefully rather than leaving
* a stuck postmaster that might interfere with subsequent test
* attempts.
- *
- * XXX is there a way to do this on Windows?
*/
#ifndef WIN32
if (kill(postmaster_pid, SIGKILL) != 0 &&
errno != ESRCH)
fprintf(stderr, _("\n%s: could not kill failed postmaster: %s\n"),
progname, strerror(errno));
#endif
exit_nicely(2);
--- 1563,1579 ----
* in startup. Try to kill it ungracefully rather than leaving
* a stuck postmaster that might interfere with subsequent test
* attempts.
*/
#ifndef WIN32
if (kill(postmaster_pid, SIGKILL) != 0 &&
errno != ESRCH)
+
fprintf(stderr, _("\n%s: could not kill failed postmaster: %s\n"),
progname, strerror(errno));
+ #else
+ if (TerminateProcess(postmaster_pid, 255) == 0)
+ fprintf(stderr, _("\n%s: could not kill failed postmaster: %lu\n"),
+ progname, GetLastError());
#endif
exit_nicely(2);
Re: Updates to pg_regress.c
"Magnus Hagander" <mha@sollentuna.net> writes:
Found a couple of "XXX is there a way to do this on Windows" in
pg_regress.c that I had missed. The answer to the question is yes,
attached is a patch that does it.
Applied, along with change to make it start the temp postmaster
as "postgres" not "postmaster".
regards, tom lane