Skip to content

Commit

Permalink
fix(cli): wait for the command to finish (#1024)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
  • Loading branch information
migmartri committed Jun 24, 2024
1 parent 736cbaf commit 10b4400
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/cli/cmd/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,24 @@ func (a *app) handleCallback(w http.ResponseWriter, r *http.Request) {
}

func openbrowser(url string) error {
var err error
var cmd *exec.Cmd

switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
cmd = exec.Command("xdg-open", url)
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
case "darwin":
err = exec.Command("open", url).Start()
cmd = exec.Command("open", url)
default:
err = fmt.Errorf("unsupported platform")
return fmt.Errorf("unsupported platform")
}

return err
if err := cmd.Start(); err != nil {
return err
}

return cmd.Wait()
}

// Retrieve loginURL from the control plane
Expand Down

0 comments on commit 10b4400

Please sign in to comment.