github.com/ocurr/cryorio@v0.0.0-20220116160810-2fb94073801b/roborio/test_conn_test.go (about)

     1  package roborio
     2  
     3  import (
     4  	"os"
     5  	"os/exec"
     6  	"strings"
     7  )
     8  
     9  type TestConn struct {
    10  	dir string
    11  }
    12  
    13  func (c *TestConn) Close() error {
    14  	return nil
    15  }
    16  
    17  func (c *TestConn) Exec(command string) ([]byte, error) {
    18  	os.Chdir(c.dir)
    19  	cmd := []string{}
    20  	cmd = append(cmd, strings.Split(command, " ")...)
    21  	return exec.Command(cmd[0], cmd[1:]...).CombinedOutput()
    22  }