From dee0b7f8b8dab7b452d1a57615b4cc48e76c6e7c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 1 Mar 2022 20:17:31 -0800 Subject: [PATCH] cmd/tailscale: tell gokrazy to not manage the CLI as a daemon In the future we'll probably want to run the "tailscale web" server instead, but for now stop the infinite restart loop. See https://gokrazy.org/userguide/process-interface/ for details. Updates #1866 Change-Id: I4133a5fdb859b848813972620495865727fe397a Signed-off-by: Brad Fitzpatrick (cherry picked from commit f18bb6397be81ad316fbc2905ab315cc1644bb3d) --- cmd/tailscale/cli/cli.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index 7cc4e2778..adf1e90f2 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -129,6 +129,13 @@ func Run(args []string) error { if len(args) == 1 && (args[0] == "-V" || args[0] == "--version") { args = []string{"version"} } + if runtime.GOOS == "linux" && distro.Get() == distro.Gokrazy && len(args) == 0 && + os.Getenv("GOKRAZY_FIRST_START") == "1" { + // Exit with 125 otherwise the CLI binary is restarted + // forever in a loop by the Gokrazy process supervisor. + // See https://gokrazy.org/userguide/process-interface/ + os.Exit(125) + } var warnOnce sync.Once tailscale.SetVersionMismatchHandler(func(clientVer, serverVer string) {