summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2025-01-12 09:57:38 +0100
committerBrad Fitzpatrick <bradfitz@tailscale.com>2025-01-14 11:34:26 -0800
commit62656fdb1e0d082634f562e0ef5a87823116fa26 (patch)
treeb112d0fa4ea5777148bdee2d2c24acbc6490a484
parent1b41fdeddb6598b35ba15cc6b07740e0cc0e8411 (diff)
downloadtailscale-release-branch/1.78.tar.xz
tailscale-release-branch/1.78.zip
cmd/tailscale/cli: only exit silently if len(args) == 0 [gokrazy]release-branch/1.78
This amends commit b7e48058c8d243adf1ff687e3e92d3fb02b035ea. 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 https://github.com/gokrazy/gokrazy/issues/286 Change-Id: Ie18ebd08022cae82564389e9e80732ad30eb308a Signed-off-by: Michael Stapelberg <michael@stapelberg.de> (cherry picked from commit 64ab0ddff14cfcae55b66017ba104afd3640e422)
-rw-r--r--cmd/tailscale/cli/cli.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go
index 66961b2e0..542a2e464 100644
--- a/cmd/tailscale/cli/cli.go
+++ b/cmd/tailscale/cli/cli.go
@@ -84,9 +84,9 @@ 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 && 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.
+ if runtime.GOOS == "linux" && os.Getenv("GOKRAZY_FIRST_START") == "1" && distro.Get() == distro.Gokrazy && os.Getppid() == 1 && len(args) == 0 {
+ // We're running on gokrazy and the user did not specify 'up'.
+ // Don't run the tailscale CLI and spam logs with usage; just exit.
// See https://gokrazy.org/development/process-interface/
os.Exit(0)
}