mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-20 06:32:01 +00:00
cmd/tailscale/cli: don't ExitOnError on js/wasm
An os.Exit brings down the whole wasm module. Updates #3157 Change-Id: I3daa97fd854715b901f3dbb04b57d841576b60b1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
@@ -77,6 +77,14 @@ func ActLikeCLI() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func newFlagSet(name string) *flag.FlagSet {
|
||||
onError := flag.ExitOnError
|
||||
if runtime.GOOS == "js" {
|
||||
onError = flag.ContinueOnError
|
||||
}
|
||||
return flag.NewFlagSet(name, onError)
|
||||
}
|
||||
|
||||
// Run runs the CLI. The args do not include the binary name.
|
||||
func Run(args []string) error {
|
||||
if len(args) == 1 && (args[0] == "-V" || args[0] == "--version") {
|
||||
@@ -90,7 +98,7 @@ func Run(args []string) error {
|
||||
})
|
||||
})
|
||||
|
||||
rootfs := flag.NewFlagSet("tailscale", flag.ExitOnError)
|
||||
rootfs := newFlagSet("tailscale")
|
||||
rootfs.StringVar(&rootArgs.socket, "socket", paths.DefaultTailscaledSocket(), "path to tailscaled's unix socket")
|
||||
|
||||
rootCmd := &ffcli.Command{
|
||||
|
Reference in New Issue
Block a user