diff --git a/cmd/dmsg-socks5/commands/dmsg-socks5.go b/cmd/dmsg-socks5/commands/dmsg-socks5.go index 3d89ef2f..0a7e1014 100644 --- a/cmd/dmsg-socks5/commands/dmsg-socks5.go +++ b/cmd/dmsg-socks5/commands/dmsg-socks5.go @@ -4,6 +4,7 @@ package commands import ( "context" "fmt" + "log" "net/http" "os" "os/signal" @@ -30,6 +31,12 @@ var ( dmsgPort uint16 ) +// Execute executes root CLI command. +func Execute() { + if err := RootCmd.Execute(); err != nil { + log.Fatal("Failed to execute command: ", err) + } +} func init() { RootCmd.AddCommand( serveCmd, diff --git a/cmd/dmsg-socks5/dmsg-socks5.go b/cmd/dmsg-socks5/dmsg-socks5.go index 776fae8b..a68f1f03 100644 --- a/cmd/dmsg-socks5/dmsg-socks5.go +++ b/cmd/dmsg-socks5/dmsg-socks5.go @@ -30,7 +30,7 @@ func main() { NoExtraNewlines: true, NoBottomNewline: true, }) - commands.RootCmd.Execute() + commands.Execute() } const help = "Usage:\r\n" +