1111 * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212 * Portions Copyright (c) 1994, Regents of the University of California
1313 *
14- * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.21 2006/09/19 15:36:08 tgl Exp $
14+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.22 2006/09/24 17:10:18 tgl Exp $
1515 *
1616 *-------------------------------------------------------------------------
1717 */
@@ -615,7 +615,7 @@ psql_command(const char *database, const char *query, ...)
615615/*
616616 * Spawn a process to execute the given shell command; don't wait for it
617617 *
618- * Returns the process ID so we can wait for it later
618+ * Returns the process ID(or HANDLE) so we can wait for it later
619619 */
620620static PID_TYPE
621621spawn_process (const char * cmdline )
@@ -1512,7 +1512,7 @@ main(int argc, char *argv[])
15121512 */
15131513header (_ ("starting postmaster" ));
15141514snprintf (buf ,sizeof (buf ),
1515- SYSTEMQUOTE "\"%s/postmaster \" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/log/postmaster.log\" 2>&1" SYSTEMQUOTE ,
1515+ SYSTEMQUOTE "\"%s/postgres \" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/log/postmaster.log\" 2>&1" SYSTEMQUOTE ,
15161516bindir ,temp_install ,
15171517debug ?" -d 5" :"" ,
15181518hostname ?hostname :"" ,
@@ -1541,16 +1541,16 @@ main(int argc, char *argv[])
15411541
15421542/*
15431543 * Fail immediately if postmaster has exited
1544- *
1545- * XXX is there a way to do this on Windows?
15461544 */
15471545#ifndef WIN32
15481546if (kill (postmaster_pid ,0 )!= 0 )
1547+ #else
1548+ if (WaitForSingleObject (postmaster_pid ,0 )== WAIT_OBJECT_0 )
1549+ #endif
15491550{
15501551fprintf (stderr ,_ ("\n%s: postmaster failed\nExamine %s/log/postmaster.log for the reason\n" ),progname ,outputdir );
15511552exit_nicely (2 );
15521553}
1553- #endif
15541554
15551555pg_usleep (1000000L );
15561556}
@@ -1563,14 +1563,16 @@ main(int argc, char *argv[])
15631563 * in startup. Try to kill it ungracefully rather than leaving
15641564 * a stuck postmaster that might interfere with subsequent test
15651565 * attempts.
1566- *
1567- * XXX is there a way to do this on Windows?
15681566 */
15691567#ifndef WIN32
15701568if (kill (postmaster_pid ,SIGKILL )!= 0 &&
15711569errno != ESRCH )
15721570fprintf (stderr ,_ ("\n%s: could not kill failed postmaster: %s\n" ),
15731571progname ,strerror (errno ));
1572+ #else
1573+ if (TerminateProcess (postmaster_pid ,255 )== 0 )
1574+ fprintf (stderr ,_ ("\n%s: could not kill failed postmaster: %lu\n" ),
1575+ progname ,GetLastError ());
15741576#endif
15751577
15761578exit_nicely (2 );