Skip to content

Commit 019e96b

Browse files
committed
Release stdin/out/err to avoid blocking
1 parent 98aa806 commit 019e96b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

start.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
9191

9292
// Start detached child
9393
c := exec.Command(exePath, childArgs...)
94-
c.Stderr = os.Stderr
95-
c.Stdout = os.Stdout
96-
c.Stdin = os.Stdin
97-
c.Start()
94+
if err := c.Start(); err != nil {
95+
log.Fatalf("Failed to start detached child: %#v", err)
96+
}
97+
c.Process.Release()
9898

9999
// Create starter client
100100
scheme := "http"
@@ -111,6 +111,7 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
111111
}
112112

113113
// Wait for detached starter to be alive
114+
log.Info("Waiting for starter API to be available...")
114115
rootCtx := context.Background()
115116
for {
116117
ctx, cancel := context.WithTimeout(rootCtx, time.Second)
@@ -124,6 +125,7 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
124125

125126
// Wait until all servers ready (if needed)
126127
if waitForServers {
128+
log.Info("Waiting for database instances to be available...")
127129
for {
128130
var err error
129131
ctx, cancel := context.WithTimeout(rootCtx, time.Second)
@@ -147,5 +149,6 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
147149
}
148150
time.Sleep(time.Millisecond * 100)
149151
}
152+
log.Info("Database instances are available.")
150153
}
151154
}

0 commit comments

Comments
 (0)