using System;
using System.Diagnostics;
namespace killed_process_return
{
class Program
{
static void Main(string[] args)
{
var p = Process.Start("sleep", "10");
p.Kill();
p.WaitForExit();
Console.WriteLine(p.ExitCode);
}
}
}
bash-3.2$ dotnet run -f netcoreapp2.0
137
bash-3.2$ dotnet run -f netcoreapp2.1
128
The 2.0 behavior matches my shells and some searching: it's SIGKILL (9) + exited-due-to-signal (128).
This was discovered when we updated MSBuild to use the preview2 runtime for testing (worked around with dotnet/msbuild@a476aa5). The repro there is fairly complicated, since we don't use Process.Kill(), instead manually killing an entire process tree.
In MSBuild, we sent SIGTERM and expect 143 instead of 137, but I assume it's the same underlying cause.
Mono does not exhibit this behavior on macOS High Sierra, so I don't think it's an OS change.
dotnet --info
bash-3.2$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.300-preview2-008530
Commit: 822ae6d43a
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.300-preview2-008530/
Host (useful for support):
Version: 2.1.0-preview2-26406-04
Commit: 6833f3026b
.NET Core SDKs installed:
1.1.0-preview1-005104 [/usr/local/share/dotnet/sdk]
2.0.0-preview3-006845 [/usr/local/share/dotnet/sdk]
2.0.0 [/usr/local/share/dotnet/sdk]
2.1.3 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]
2.1.300-preview2-008530 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0-preview2-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0-preview2-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0-preview2-26406-04 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
The 2.0 behavior matches my shells and some searching: it's
SIGKILL(9) + exited-due-to-signal (128).This was discovered when we updated MSBuild to use the preview2 runtime for testing (worked around with dotnet/msbuild@a476aa5). The repro there is fairly complicated, since we don't use
Process.Kill(), instead manually killing an entire process tree.In MSBuild, we sent
SIGTERMand expect 143 instead of 137, but I assume it's the same underlying cause.Mono does not exhibit this behavior on macOS High Sierra, so I don't think it's an OS change.
dotnet --info