From c12a374b63aa01423ea52b6c81cc83c32e2fca07 Mon Sep 17 00:00:00 2001 From: Dominic Dagradi Date: Wed, 22 Feb 2017 10:29:33 -0800 Subject: [PATCH] sdk/windows: poll pg_isready for successful exit code Closes #556 --- installer/windows/ChainMgr/ChainMgr.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/installer/windows/ChainMgr/ChainMgr.go b/installer/windows/ChainMgr/ChainMgr.go index c334a7bd7b..ba4bfd660c 100755 --- a/installer/windows/ChainMgr/ChainMgr.go +++ b/installer/windows/ChainMgr/ChainMgr.go @@ -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) } }