Skip to content

Commit

Permalink
TimeoutFailsEvenWhenExitCodeIsIgnored: add back STILL_ACTIVE
Browse files Browse the repository at this point in the history
  • Loading branch information
tmds committed Feb 11, 2021
1 parent 1b0177c commit 6f67a09
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Tasks.UnitTests/Exec_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]
Expand Down

0 comments on commit 6f67a09

Please sign in to comment.