1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-18 11:39:11 -04:00

proper handle stdin

This commit is contained in:
vcptr
2019-12-14 23:44:10 +08:00
parent 1bb34bfe17
commit 75f0879c12
4 changed files with 17 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ package json
import (
"io"
"os"
"v2ray.com/core"
"v2ray.com/core/common"
@@ -20,7 +21,7 @@ func init() {
Loader: func(input interface{}) (*core.Config, error) {
switch v := input.(type) {
case cmdarg.Arg:
jsonContent, err := ctlcmd.Run(append([]string{"config"}, v...), nil)
jsonContent, err := ctlcmd.Run(append([]string{"config"}, v...), os.Stdin)
if err != nil {
return nil, newError("failed to execute v2ctl to convert config file.").Base(err).AtWarning()
}