mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
fix: fix exec windows command test failed
This commit is contained in:
@@ -56,6 +56,9 @@ func ExecCommand(command string) (stdout, stderr string, err error) {
|
||||
var errout bytes.Buffer
|
||||
|
||||
cmd := exec.Command("/bin/bash", "-c", command)
|
||||
if IsWindows() {
|
||||
cmd = exec.Command("cmd")
|
||||
}
|
||||
cmd.Stdout = &out
|
||||
cmd.Stderr = &errout
|
||||
err = cmd.Run()
|
||||
|
||||
@@ -56,5 +56,7 @@ func TestExecCommand(t *testing.T) {
|
||||
t.Logf("error: %v\n", err)
|
||||
}
|
||||
|
||||
assert.IsNotNil(err)
|
||||
if !IsWindows() {
|
||||
assert.IsNotNil(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user