1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

32 lines
618 B
Go
Raw Normal View History

2016-08-09 00:55:36 +02:00
// +build !coverage
package scenarios
import (
2016-12-16 21:39:00 +01:00
"bytes"
2016-11-18 00:01:37 +01:00
"fmt"
2016-08-09 00:55:36 +02:00
"os"
"os/exec"
)
func BuildV2Ray() error {
2017-03-31 17:12:33 +02:00
genTestBinaryPath()
2016-11-18 00:01:37 +01:00
if _, err := os.Stat(testBinaryPath); err == nil {
2016-08-09 00:55:36 +02:00
return nil
}
2016-11-22 00:19:51 +01:00
fmt.Printf("Building V2Ray into path (%s)\n", testBinaryPath)
2016-11-18 00:01:37 +01:00
cmd := exec.Command("go", "build", "-tags=json", "-o="+testBinaryPath, GetSourcePath())
2016-08-09 00:55:36 +02:00
return cmd.Run()
}
2016-12-16 21:39:00 +01:00
func RunV2RayProtobuf(config []byte) *exec.Cmd {
2017-03-31 17:12:33 +02:00
genTestBinaryPath()
2016-12-16 21:39:00 +01:00
proc := exec.Command(testBinaryPath, "-config=stdin:", "-format=pb")
proc.Stdin = bytes.NewBuffer(config)
proc.Stderr = os.Stderr
proc.Stdout = os.Stdout
return proc
}