Adding Kill(bool entireProcessTree) -- terminates a process tree (dotnet/corefx#34147)
authorBen Gribaudo <ben@benntiff.com>
Sat, 2 Feb 2019 01:09:16 +0000 (19:09 -0600)
committerDan Moseley <danmose@microsoft.com>
Sat, 2 Feb 2019 01:09:16 +0000 (17:09 -0800)
commit7bc0c52080b42f1196ee38f7e7501270fefb6dea
tree640aaa87a4552ce8be3e0bdaaccc59d6c1a9e036
parent40fc2f2c81281f0668a8dc32d9240479cb05d536
Adding Kill(bool entireProcessTree) -- terminates a process tree (dotnet/corefx#34147)

* Adding Kill(bool entireProcessTree)

* Slightly cleaning up NtQueryInformationProcess interop code

* Trimming down PROCESSINFOCLASS enum members

* Refactoring--adjusting indents, changing param from ref to out, etc.

* Revising NtQueryInformationProcess-related code

* Comment & indentation tweaks

* TryGetParentProcessId -> GetParentProcessId rename/refactoring -- includes eliminating the output parameter

* Removing UAP double-definition of KillTree()

* Moving code so that not included in Uap build & tests so that not included in Uap and NetFx builds

* Moving relevant code from Windows -> Win32

* Moving relevant code from Windows -> Win32

* Working to satisfy contract for Uap (code written to fail test to verify that it works)

* Typo fix (missing return signature)

* Removing unneeded Uap-specific test file

* Adding temp. test to verify that UAP CI is catching test failures.

* Using lists (vs. enumerables) as test assert arguments

* Giving Kill() a moment to take effect

* Removing whitespace

* Removing irrelevant comment

* Revising initial check that ensures process has started.

* Moving process tree creation outside of finally

* Adding retry logic to tests

* Adjusting retry times/delay

* Adding backoff to retry helper

* Introducing non-auto-dispose variant of CreateProcess; refactoring

* Improving exception handling

* Moving catch

* Minor refactoring/reformatting

* Testing test execution by CI

* Partially removing code testing CI system

* Experimenting with implementing on OSX

* Adding cast

* Re-adding [ActiveIssue] attribute accidentally removed

* Re-adding inadvertently-removed commented-out test attributes

* Allowing aggregated Win32Exceptions to propagate out; disallowing calling Kill(true) on tree containing caller

* Adjusting test attributes, removing CI verification test, adjusting expected exception

* Marking non-local process test as platform-specific

* Adding PlatformNotSupported throw for Uap.

* Adding missing closing XML tag

* XML doc tag tweak

* Cleaning up two merge artifacts (whitespace + comment)

* Adding console output for debugging

* Fixing typo

* Removing logging to console

* Removing unused parameter

* Unix & OSX exception tweaks

* Variable rename

* Whitespace tweak

* Refactoring IsInTreeOf to use @danmosemsft's optimization suggestion; Renaming method

* Missed a rename

* Tweaking

* Reworking IsSelfOrDescendant to use refactored GetChildProcesses

* Minor fix

* Applying minor tweaks suggested by @krwq

* Adding a delay safety cutoff to RetryWithBackoff per
@krwq's suggestion.

* Adjusting backoff delay max to 10 seconds.

* IsSelfOrDescendant -> IsSelfOrDescendantOf

* Unix: If Stop() fails, don't try to continue with the process (thanks @tmds!).

* Fixing typo.

* Adding comments about kill/stop returning before termination/stopping completes.

* Adding comment.

Commit migrated from https://github.com/dotnet/corefx/commit/81bd671efda5db20fae1eb381aeff2cf8ea727ac
20 files changed:
src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs
src/libraries/Common/src/Interop/Unix/System.Native/Interop.Kill.cs
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryInformationProcess.cs [new file with mode: 0644]
src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
src/libraries/System.Diagnostics.Process/src/Resources/Strings.resx
src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs [new file with mode: 0644]
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Uap.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs
src/libraries/System.Diagnostics.Process/tests/Helpers.cs [new file with mode: 0644]
src/libraries/System.Diagnostics.Process/tests/ProcessTestBase.cs
src/libraries/System.Diagnostics.Process/tests/ProcessTests.netcoreapp.cs
src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj