Skip to content

Commit 10b4400

Browse files
authored
fix(cli): wait for the command to finish (#1024)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 736cbaf commit 10b4400

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app/cli/cmd/auth_login.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,24 @@ func (a *app) handleCallback(w http.ResponseWriter, r *http.Request) {
167167
}
168168

169169
func openbrowser(url string) error {
170-
var err error
170+
var cmd *exec.Cmd
171171

172172
switch runtime.GOOS {
173173
case "linux":
174-
err = exec.Command("xdg-open", url).Start()
174+
cmd = exec.Command("xdg-open", url)
175175
case "windows":
176-
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
176+
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
177177
case "darwin":
178-
err = exec.Command("open", url).Start()
178+
cmd = exec.Command("open", url)
179179
default:
180-
err = fmt.Errorf("unsupported platform")
180+
return fmt.Errorf("unsupported platform")
181181
}
182182

183-
return err
183+
if err := cmd.Start(); err != nil {
184+
return err
185+
}
186+
187+
return cmd.Wait()
184188
}
185189

186190
// Retrieve loginURL from the control plane

0 commit comments

Comments
 (0)