server_env_regular.go 504 B

123456789101112131415161718192021222324252627
  1. // +build !coverage
  2. package scenarios
  3. import (
  4. "os"
  5. "os/exec"
  6. )
  7. func BuildV2Ray() error {
  8. binaryPath := GetTestBinaryPath()
  9. if _, err := os.Stat(binaryPath); err == nil {
  10. return nil
  11. }
  12. cmd := exec.Command("go", "build", "-tags=json", "-o="+binaryPath, GetSourcePath())
  13. return cmd.Run()
  14. }
  15. func RunV2Ray(configFile string) *exec.Cmd {
  16. binaryPath := GetTestBinaryPath()
  17. proc := exec.Command(binaryPath, "-config", configFile)
  18. proc.Stderr = os.Stderr
  19. proc.Stdout = os.Stdout
  20. return proc
  21. }