From e05ee55545c94fa87749e098ce98989b18abed93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 9 Aug 2022 14:49:17 +0800 Subject: [PATCH] Improve cmd --- cmd/sing-box/cmd_check.go | 1 + cmd/sing-box/cmd_format.go | 1 + cmd/sing-box/cmd_version.go | 1 + cmd/sing-box/debug.go | 9 ++++++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/sing-box/cmd_check.go b/cmd/sing-box/cmd_check.go index 3360ea6c..88439d0b 100644 --- a/cmd/sing-box/cmd_check.go +++ b/cmd/sing-box/cmd_check.go @@ -16,6 +16,7 @@ var commandCheck = &cobra.Command{ Use: "check", Short: "Check configuration", Run: checkConfiguration, + Args: cobra.NoArgs, } func checkConfiguration(cmd *cobra.Command, args []string) { diff --git a/cmd/sing-box/cmd_format.go b/cmd/sing-box/cmd_format.go index be56dc8e..7ca80ab4 100644 --- a/cmd/sing-box/cmd_format.go +++ b/cmd/sing-box/cmd_format.go @@ -18,6 +18,7 @@ var commandFormat = &cobra.Command{ Use: "format", Short: "Format configuration", Run: formatConfiguration, + Args: cobra.NoArgs, } func init() { diff --git a/cmd/sing-box/cmd_version.go b/cmd/sing-box/cmd_version.go index 98956535..99ce25d0 100644 --- a/cmd/sing-box/cmd_version.go +++ b/cmd/sing-box/cmd_version.go @@ -14,6 +14,7 @@ var commandVersion = &cobra.Command{ Use: "version", Short: "Print current version of sing-box", Run: printVersion, + Args: cobra.NoArgs, } func printVersion(cmd *cobra.Command, args []string) { diff --git a/cmd/sing-box/debug.go b/cmd/sing-box/debug.go index b93a042f..5134ff4c 100644 --- a/cmd/sing-box/debug.go +++ b/cmd/sing-box/debug.go @@ -5,8 +5,15 @@ package main import ( "net/http" _ "net/http/pprof" + + "github.com/sagernet/sing-box/log" ) func init() { - go http.ListenAndServe("0.0.0.0:8964", nil) + go func() { + err := http.ListenAndServe("0.0.0.0:8964", nil) + if err != nil { + log.Debug(err) + } + }() }