Browse Source

trim err msg

vcptr 5 years ago
parent
commit
e50afd6e44
2 changed files with 2 additions and 6 deletions
  1. 1 1
      common/platform/ctlcmd/ctlcmd.go
  2. 1 5
      main/main.go

+ 1 - 1
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)
 	}

+ 1 - 5
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)
 	}