veyron/tools/identity: Bugfix for some window managers.
The identity tool uses "xdg-open" on Linux to open up a browser
window. On some window managers, 'xdg-open <url>' will not return
until the browser is closed, while on others (like GNOME) it returns
right after opening <url> in a tab.
The fix is to not wait for "xdg-open" to return.
Change-Id: Ib695bec621aedb0d3b350151fdc91dc483b9cbea
diff --git a/tools/identity/googleoauth.go b/tools/identity/googleoauth.go
index 92421a2..d556e10 100644
--- a/tools/identity/googleoauth.go
+++ b/tools/identity/googleoauth.go
@@ -84,7 +84,12 @@
url := googleoauth.NewOAuthConfig(clientID, "", redirectURL).AuthCodeURL(state)
fmt.Fprintln(os.Stderr, "Please visit the following URL to authenticate with Google:")
fmt.Fprintln(os.Stderr, url)
- exec.Command(openCommand, url).Run()
+ // Make an attempt to start the browser as a convenience.
+ // If it fails, doesn't matter - the client can see the URL printed above.
+ // Use exec.Command().Start instead of exec.Command().Run since there is no
+ // need to wait for the command to return (and indeed on some window managers,
+ // the command will not exit until the browser is closed).
+ exec.Command(openCommand, url).Start()
return result, nil
}