Skip to content

Commit 64ab0dd

Browse files
stapelbergbradfitz
authored andcommitted
cmd/tailscale/cli: only exit silently if len(args) == 0
This amends commit b7e4805. That commit broke all documented ways of starting Tailscale on gokrazy: https://gokrazy.org/packages/tailscale/ — both Option A (tailscale up) and Option B (tailscale up --auth-key) rely on the tailscale CLI working. I verified that the tailscale CLI just prints it help when started without arguments, i.e. it does not stay running and is not restarted. I verified that the tailscale CLI successfully exits when started with tailscale up --auth-key, regardless of whether the node has joined the tailnet yet or not. I verified that the tailscale CLI successfully waits and exits when started with tailscale up, as expected. fixes gokrazy/gokrazy#286 Signed-off-by: Michael Stapelberg <[email protected]>
1 parent 6ccde36 commit 64ab0dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd/tailscale/cli/cli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ var localClient = tailscale.LocalClient{
8484

8585
// Run runs the CLI. The args do not include the binary name.
8686
func Run(args []string) (err error) {
87-
if runtime.GOOS == "linux" && os.Getenv("GOKRAZY_FIRST_START") == "1" && distro.Get() == distro.Gokrazy && os.Getppid() == 1 {
88-
// We're running on gokrazy and it's the first start.
89-
// Don't run the tailscale CLI as a service; just exit.
87+
if runtime.GOOS == "linux" && os.Getenv("GOKRAZY_FIRST_START") == "1" && distro.Get() == distro.Gokrazy && os.Getppid() == 1 && len(args) == 0 {
88+
// We're running on gokrazy and the user did not specify 'up'.
89+
// Don't run the tailscale CLI and spam logs with usage; just exit.
9090
// See https://gokrazy.org/development/process-interface/
9191
os.Exit(0)
9292
}

0 commit comments

Comments
 (0)