mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
Fix pg_ctl -w to properly wait on server startup.
This commit is contained in:
parent
3bd726333c
commit
34f34a041c
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.24 2004/07/29 16:11:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.25 2004/08/21 03:12:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -404,12 +404,23 @@ test_postmaster_connection(void)
|
||||
|
||||
for (i = 0; i < wait_seconds; i++)
|
||||
{
|
||||
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL, "template1", NULL, NULL)) != NULL)
|
||||
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
|
||||
"template1", NULL, NULL)) != NULL &&
|
||||
PQstatus(conn) == CONNECTION_OK)
|
||||
{
|
||||
PQfinish(conn);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!silence_echo)
|
||||
{
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
}
|
||||
pg_usleep(1000000); /* 1 sec */
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
|
Loading…
Reference in New Issue
Block a user