Skip to content

Commit

Permalink
sdk/windows: poll pg_isready for successful exit code
Browse files Browse the repository at this point in the history
Closes #556
  • Loading branch information
dominic committed Feb 22, 2017
1 parent d875725 commit c12a374
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions installer/windows/ChainMgr/ChainMgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,14 @@ func rewriteConfig() error {
func blockUntilReady(pglog *log.Logger) {
// TODO(tessr): add a timeout or something so we can't block indefinitely
for {
out, err := exec.Command(pg+"pg_isready.exe", "-p", pgPort, "-d", "postgres").Output()
if err != nil {
pglog.Printf("out: %s; err: %s", out, err)
}
err := exec.Command(pg+"pg_isready.exe", "-p", pgPort, "-d", "postgres").Run()

if strings.Contains(string(out), "accepting") {
if err != nil {
pglog.Printf("still waiting for postgres ready status: %s", err)
} else {
return
}

pglog.Printf("still waiting for postgres ready status: %s", out)
time.Sleep(500 * time.Millisecond)
}
}
Expand Down

0 comments on commit c12a374

Please sign in to comment.