When waiting is selected for the promote action, look into pg_control until the state changes, then use the PQping-based waiting until the server is reachable.
e7010ce pg_ctl: Add wait option to promote action
doc/src/sgml/ref/pg_ctl-ref.sgml | 29 +++++++++++++++++++-----
src/bin/pg_ctl/pg_ctl.c | 45 +++++++++++++++++++++++++++-----------
src/bin/pg_ctl/t/003_promote.pl | 18 ++++++++++++++-
3 files changed, 72 insertions(+), 20 deletions(-)
Upstream: git.postgresql.org