-
Notifications
You must be signed in to change notification settings - Fork 275
simplify process code #5171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
simplify process code #5171
Conversation
@@ -5,9 +5,13 @@ namespace Microsoft.Testing.Platform.Helpers; | |||
|
|||
internal interface IProcessHandler | |||
{ | |||
IProcess GetProcessById(int pid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the new needed APIs without removing the existing ones.
While it's internal, it's used by HangDump via IVT.
This means, if user updates core MTP but didn't update HangDump, it will fail with MissingMethodException. While this has happened multiple times in the past already, let's be careful to avoid it whenever possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also hard Deprecate that old api? It should not fail on runtime, but should not build for new code.
public async Task KillAsync(int id) | ||
{ | ||
using var process = Process.GetProcessById(id); | ||
process.Kill(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill(true)
on .NET Core to kill child processes as well
less code and fixes some missing usings