rawexec: Fix Exec test on windows

This commit is contained in:
Danielle Tomlinson
2019-01-11 16:49:53 +00:00
committed by Danielle Tomlinson
parent ffcd76f03f
commit 0ecef70715

View File

@@ -417,13 +417,13 @@ func TestRawExecDriver_Exec(t *testing.T) {
if runtime.GOOS == "windows" {
// Exec a command that should work
res, err := harness.ExecTask(task.ID, []string{"echo", "hello"}, 1*time.Second)
res, err := harness.ExecTask(task.ID, []string{"cmd.exe", "/c", "echo", "hello"}, 1*time.Second)
require.NoError(err)
require.True(res.ExitResult.Successful())
require.True(len(res.Stdout) > 100)
require.Equal(string(res.Stdout), "hello\r\n")
// Exec a command that should fail
res, err = harness.ExecTask(task.ID, []string{"stat", "notarealfile123abc"}, 1*time.Second)
res, err = harness.ExecTask(task.ID, []string{"cmd.exe", "/c", "stat", "notarealfile123abc"}, 1*time.Second)
require.NoError(err)
require.False(res.ExitResult.Successful())
require.Contains(string(res.Stdout), "not recognized")