Skip to content

Commit

Permalink
Allow macOS processes to return 128 on kill
Browse files Browse the repository at this point in the history
The exit code of processes killed using our timeout appears to have
changed on macOS after taking .NET Core 2.1 preview 2. I have no idea
why, but it's consistent on my laptop and in CI. Adjusting the test
to expect 128 on Mac.
  • Loading branch information
rainersigwald committed Apr 11, 2018
1 parent f336101 commit a476aa5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Tasks.UnitTests/Exec_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ public void ExitCodeCausesFailure()
[Fact]
public void Timeout()
{
// On non-Windows the exit code of a killed process is SIGTERM (143)
int expectedExitCode = NativeMethodsShared.IsWindows ? -1 : 143;
// On non-Windows the exit code of a killed sh should be
// SIGTERM (15) + exited-due-to-signal (128) = 143.
// On .NET Core 2.1 preview2 + High Sierra it's consistently
// just 128 for some reason.
int expectedExitCode = NativeMethodsShared.IsWindows ? -1 :
NativeMethodsShared.IsOSX ? 128 : 143;

Exec exec = PrepareExec(NativeMethodsShared.IsWindows ? ":foo \n goto foo" : "while true; do sleep 1; done");
exec.Timeout = 5;
Expand Down

0 comments on commit a476aa5

Please sign in to comment.