From f79e688e0d8796eed4798ed252990024681e926a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 13 Aug 2024 11:05:59 -0700 Subject: [PATCH] cmd/tailscale/cli: fix gokrazy CLI-as-a-service detection The change in b7e48058c8d2 was too loose; it also captured the CLI being run as a child process under cmd/tta. Updates #13038 Updates #1866 Change-Id: Id410b87132938dd38ed4dd3959473c5d0d242ff5 Signed-off-by: Brad Fitzpatrick --- cmd/tailscale/cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index 6b0bb7957..efbdd3e40 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -84,7 +84,7 @@ var localClient = tailscale.LocalClient{ // Run runs the CLI. The args do not include the binary name. func Run(args []string) (err error) { - if runtime.GOOS == "linux" && os.Getenv("GOKRAZY_FIRST_START") == "1" && distro.Get() == distro.Gokrazy { + if runtime.GOOS == "linux" && os.Getenv("GOKRAZY_FIRST_START") == "1" && distro.Get() == distro.Gokrazy && os.Getppid() == 1 { // We're running on gokrazy and it's the first start. // Don't run the tailscale CLI as a service; just exit. // See https://gokrazy.org/development/process-interface/