From e50afd6e440549262aa7363441ed572e050cb215 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Tue, 31 Dec 2019 13:29:25 +0800 Subject: [PATCH] trim err msg --- common/platform/ctlcmd/ctlcmd.go | 2 +- main/main.go | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/common/platform/ctlcmd/ctlcmd.go b/common/platform/ctlcmd/ctlcmd.go index dcb0a7249..1fad1e74e 100644 --- a/common/platform/ctlcmd/ctlcmd.go +++ b/common/platform/ctlcmd/ctlcmd.go @@ -36,7 +36,7 @@ func Run(args []string, input io.Reader) (buf.MultiBuffer, error) { if err := cmd.Wait(); err != nil { msg := "failed to execute v2ctl" if errBuffer.Len() > 0 { - msg += ": " + errBuffer.MultiBuffer.String() + msg += ": \n" + strings.TrimSpace(errBuffer.MultiBuffer.String()) } return nil, newError(msg).Base(err) } diff --git a/main/main.go b/main/main.go index 298e97d12..481b998c3 100644 --- a/main/main.go +++ b/main/main.go @@ -27,7 +27,6 @@ var ( version = flag.Bool("version", false, "Show current version of V2Ray.") test = flag.Bool("test", false, "Test config file only, without launching V2Ray server.") format = flag.String("format", "json", "Format of input file.") - errNoConfig = newError("no valid config") ) func fileExists(file string) bool { @@ -134,11 +133,8 @@ func main() { server, err := startV2Ray() if err != nil { - fmt.Println(err.Error()) + fmt.Println(err) // Configuration error. Exit with a special value to prevent systemd from restarting. - if err == errNoConfig { - flag.PrintDefaults() - } os.Exit(23) }