diff --git a/src/Tasks.UnitTests/Exec_Tests.cs b/src/Tasks.UnitTests/Exec_Tests.cs index 736f1aaf598..3bc0657cab2 100644 --- a/src/Tasks.UnitTests/Exec_Tests.cs +++ b/src/Tasks.UnitTests/Exec_Tests.cs @@ -122,7 +122,6 @@ public void Timeout() [Fact] public void TimeoutFailsEvenWhenExitCodeIsIgnored() { - Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? ":foo \n goto foo" : "while true; do sleep 1; done"); exec.Timeout = 5; exec.IgnoreExitCode = true; @@ -136,8 +135,16 @@ public void TimeoutFailsEvenWhenExitCodeIsIgnored() // ToolTask does not log an error on timeout. mockEngine.Errors.ShouldBe(0); - // On non-Windows the exit code of a killed process is 128 + SIGKILL = 137 - exec.ExitCode.ShouldBe(NativeMethodsShared.IsWindows ? -1 : 137); + if (NativeMethodsShared.IsMono) + { + const int STILL_ACTIVE = 259; // When Process.WaitForExit times out. + exec.ExitCode.ShouldBeOneOf(137, STILL_ACTIVE); + } + else + { + // On non-Windows the exit code of a killed process is 128 + SIGKILL = 137 + exec.ExitCode.ShouldBe(NativeMethodsShared.IsWindows ? -1 : 137); + } } [Fact]