mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-03 20:19:07 +02:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user