[client] wait for macOS UI launch and propagate its error

Replace Start()+Process.Release() with Run() in startUIAsUser: the
launchctl/sudo/open chain is short-lived (open returns once LaunchServices
accepts the request), so waiting surfaces a launch failure to the caller
instead of swallowing it. Addresses CodeRabbit review.
This commit is contained in:
riccardom
2026-07-29 18:11:57 +02:00
parent 4b5a8c3af3
commit b09c808971
@@ -113,12 +113,8 @@ func (u *Installer) startUIAsUser() error {
launchCmd := exec.Command("launchctl", "asuser", userInfo.Uid, "sudo", "-u", username, "-H", "open", "-a", uiBinary)
log.Infof("launchCmd: %s", launchCmd.String())
if err := launchCmd.Start(); err != nil {
return fmt.Errorf("start UI process: %w", err)
}
if err := launchCmd.Process.Release(); err != nil {
log.Warnf("failed to release UI process: %v", err)
if err := launchCmd.Run(); err != nil {
return fmt.Errorf("run UI launch: %w", err)
}
log.Infof("netbird-ui started successfully for user %s", username)