From e7d5d900376bae89d77a9fc338d505f76eba872e Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Mon, 27 Jun 2022 14:56:25 -0700 Subject: [PATCH] cmd/tailscale: move call to cli.CleanUpArgs() from main() into cli.Run() (#4954) Not all distributions build from package main. Signed-off-by: Jordan Whited (cherry picked from commit bef6e2831a9b03e77ce1276ce94f8295061becc4) --- cmd/tailscale/cli/cli.go | 2 ++ cmd/tailscale/tailscale.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index a73fc71a1..fa76ba33e 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -129,6 +129,8 @@ func CleanUpArgs(args []string) []string { // Run runs the CLI. The args do not include the binary name. func Run(args []string) (err error) { + args = CleanUpArgs(args) + if len(args) == 1 && (args[0] == "-V" || args[0] == "--version") { args = []string{"version"} } diff --git a/cmd/tailscale/tailscale.go b/cmd/tailscale/tailscale.go index f5b254fe9..c69c86f64 100644 --- a/cmd/tailscale/tailscale.go +++ b/cmd/tailscale/tailscale.go @@ -17,7 +17,6 @@ func main() { args := os.Args[1:] - args = cli.CleanUpArgs(args) if name, _ := os.Executable(); strings.HasSuffix(filepath.Base(name), ".cgi") { args = []string{"web", "-cgi"} }