{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/213472248","pull_request_review_id":150317220,"id":213472248,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzQ3MjI0OA==","diff_hunk":"@@ -341,5 +342,98 @@ private bool WaitForInputIdleCore(int milliseconds)\n             }\n             return idle;\n         }\n+\n+        /// <summary>Checks whether the argument is a direct child of this process.</summary>\n+        /// <remarks>\n+        /// A child process is a process which has this process's id as its parent process id and which started after this process did.\n+        /// </remakrs>\n+        private bool IsParentOf(Process possibleChildProcess) =>\n+            StartTime < possibleChildProcess.StartTime\n+            && Id == possibleChildProcess.GetParentProcessId();\n+\n+        /// <summary>\n+        /// Attempts to get the process's parent process id.\n+        /// </summary>\n+        private unsafe int? GetParentProcessId()\n+        {\n+            // UNDONE: NtQueryInformationProcess will fail if we are not elevated and other process is. Advice is to change to use ToolHelp32 API's","path":"src/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs","position":null,"original_position":26,"commit_id":"d47ea5713dee7f629cf7478d5f1650536667552f","original_commit_id":"5361d19d195124243c97c0c608c4178c6c5f747f","user":{"login":"danmosemsft","id":6385855,"node_id":"MDQ6VXNlcjYzODU4NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/6385855?v=4","gravatar_id":"","url":"https://api.github.com/users/danmosemsft","html_url":"https://github.com/danmosemsft","followers_url":"https://api.github.com/users/danmosemsft/followers","following_url":"https://api.github.com/users/danmosemsft/following{/other_user}","gists_url":"https://api.github.com/users/danmosemsft/gists{/gist_id}","starred_url":"https://api.github.com/users/danmosemsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danmosemsft/subscriptions","organizations_url":"https://api.github.com/users/danmosemsft/orgs","repos_url":"https://api.github.com/users/danmosemsft/repos","events_url":"https://api.github.com/users/danmosemsft/events{/privacy}","received_events_url":"https://api.github.com/users/danmosemsft/received_events","type":"User","site_admin":false},"body":"OK good. By curious happenstance I believe I was the one that wrote all that code you are copying, so I would have added that comment, but it was nearly 15 years ago so I have no memory of any details.","created_at":"2018-08-28T21:06:21Z","updated_at":"2018-08-28T21:06:21Z","html_url":"https://github.com/dotnet/corefx/pull/31827#discussion_r213472248","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/31827","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/213472248"},"html":{"href":"https://github.com/dotnet/corefx/pull/31827#discussion_r213472248"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/31827"}},"in_reply_to_id":212767238},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/31827","id":209237095,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MjM3MDk1","html_url":"https://github.com/dotnet/corefx/pull/31827","diff_url":"https://github.com/dotnet/corefx/pull/31827.diff","patch_url":"https://github.com/dotnet/corefx/pull/31827.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/31827","number":31827,"state":"open","locked":false,"title":"Adding Kill(bool entireProcessTree) -- best-effort attempt to terminate a process tree","user":{"login":"bgribaudo","id":857202,"node_id":"MDQ6VXNlcjg1NzIwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/857202?v=4","gravatar_id":"","url":"https://api.github.com/users/bgribaudo","html_url":"https://github.com/bgribaudo","followers_url":"https://api.github.com/users/bgribaudo/followers","following_url":"https://api.github.com/users/bgribaudo/following{/other_user}","gists_url":"https://api.github.com/users/bgribaudo/gists{/gist_id}","starred_url":"https://api.github.com/users/bgribaudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgribaudo/subscriptions","organizations_url":"https://api.github.com/users/bgribaudo/orgs","repos_url":"https://api.github.com/users/bgribaudo/repos","events_url":"https://api.github.com/users/bgribaudo/events{/privacy}","received_events_url":"https://api.github.com/users/bgribaudo/received_events","type":"User","site_admin":false},"body":"[Implements API approved by #26234]\r\n\r\n## Summary\r\nWhen `Kill(bool entireProcessTree)`'s argument is false, behaves identical to `Kill()`; when true, makes a best-effort attempt to terminate the current process and all descendant processes (children, grandchildren, etc.).\r\n\r\n## Platform Implementation Status\r\nImplemented for Windows and Linux; not implemented for UAP, UnknownUnix or FreeBSD/OSX. \r\n\r\nLooks easy to implement for OSX (comment added in Process.OSX.cs with implementation idea), just don't have an OSX system to test against.\r\n\r\n## Notes\r\nPotential low-hanging fruit: Behind-the-scenes, the logic in this PR enumerates child processes. This functionality could be leveraged to easily implement #25855. \r\n\r\nWindows-specific logic inspired by [msbuild's NativeMethodsShared KillTree](https://github.com/Microsoft/msbuild/blob/0591c15d6c638cad38091fbe625dde968f86748d/src/Shared/NativeMethodsShared.cs#L1068).","created_at":"2018-08-17T19:27:05Z","updated_at":"2018-08-28T21:06:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ee75695b7bcb73b1c49da61e1a8b76d75b53fed","assignee":{"login":"krwq","id":660048,"node_id":"MDQ6VXNlcjY2MDA0OA==","avatar_url":"https://avatars1.githubusercontent.com/u/660048?v=4","gravatar_id":"","url":"https://api.github.com/users/krwq","html_url":"https://github.com/krwq","followers_url":"https://api.github.com/users/krwq/followers","following_url":"https://api.github.com/users/krwq/following{/other_user}","gists_url":"https://api.github.com/users/krwq/gists{/gist_id}","starred_url":"https://api.github.com/users/krwq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krwq/subscriptions","organizations_url":"https://api.github.com/users/krwq/orgs","repos_url":"https://api.github.com/users/krwq/repos","events_url":"https://api.github.com/users/krwq/events{/privacy}","received_events_url":"https://api.github.com/users/krwq/received_events","type":"User","site_admin":false},"assignees":[{"login":"krwq","id":660048,"node_id":"MDQ6VXNlcjY2MDA0OA==","avatar_url":"https://avatars1.githubusercontent.com/u/660048?v=4","gravatar_id":"","url":"https://api.github.com/users/krwq","html_url":"https://github.com/krwq","followers_url":"https://api.github.com/users/krwq/followers","following_url":"https://api.github.com/users/krwq/following{/other_user}","gists_url":"https://api.github.com/users/krwq/gists{/gist_id}","starred_url":"https://api.github.com/users/krwq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krwq/subscriptions","organizations_url":"https://api.github.com/users/krwq/orgs","repos_url":"https://api.github.com/users/krwq/repos","events_url":"https://api.github.com/users/krwq/events{/privacy}","received_events_url":"https://api.github.com/users/krwq/received_events","type":"User","site_admin":false},{"login":"bgribaudo","id":857202,"node_id":"MDQ6VXNlcjg1NzIwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/857202?v=4","gravatar_id":"","url":"https://api.github.com/users/bgribaudo","html_url":"https://github.com/bgribaudo","followers_url":"https://api.github.com/users/bgribaudo/followers","following_url":"https://api.github.com/users/bgribaudo/following{/other_user}","gists_url":"https://api.github.com/users/bgribaudo/gists{/gist_id}","starred_url":"https://api.github.com/users/bgribaudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgribaudo/subscriptions","organizations_url":"https://api.github.com/users/bgribaudo/orgs","repos_url":"https://api.github.com/users/bgribaudo/repos","events_url":"https://api.github.com/users/bgribaudo/events{/privacy}","received_events_url":"https://api.github.com/users/bgribaudo/received_events","type":"User","site_admin":false},{"login":"wtgodbe","id":14283640,"node_id":"MDQ6VXNlcjE0MjgzNjQw","avatar_url":"https://avatars3.githubusercontent.com/u/14283640?v=4","gravatar_id":"","url":"https://api.github.com/users/wtgodbe","html_url":"https://github.com/wtgodbe","followers_url":"https://api.github.com/users/wtgodbe/followers","following_url":"https://api.github.com/users/wtgodbe/following{/other_user}","gists_url":"https://api.github.com/users/wtgodbe/gists{/gist_id}","starred_url":"https://api.github.com/users/wtgodbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wtgodbe/subscriptions","organizations_url":"https://api.github.com/users/wtgodbe/orgs","repos_url":"https://api.github.com/users/wtgodbe/repos","events_url":"https://api.github.com/users/wtgodbe/events{/privacy}","received_events_url":"https://api.github.com/users/wtgodbe/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":247536927,"node_id":"MDU6TGFiZWwyNDc1MzY5Mjc=","url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Diagnostics.Process","name":"area-System.Diagnostics.Process","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/31827/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/31827/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/31827/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/d47ea5713dee7f629cf7478d5f1650536667552f","head":{"label":"bgribaudo:ProcessKillPR","ref":"ProcessKillPR","sha":"d47ea5713dee7f629cf7478d5f1650536667552f","user":{"login":"bgribaudo","id":857202,"node_id":"MDQ6VXNlcjg1NzIwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/857202?v=4","gravatar_id":"","url":"https://api.github.com/users/bgribaudo","html_url":"https://github.com/bgribaudo","followers_url":"https://api.github.com/users/bgribaudo/followers","following_url":"https://api.github.com/users/bgribaudo/following{/other_user}","gists_url":"https://api.github.com/users/bgribaudo/gists{/gist_id}","starred_url":"https://api.github.com/users/bgribaudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgribaudo/subscriptions","organizations_url":"https://api.github.com/users/bgribaudo/orgs","repos_url":"https://api.github.com/users/bgribaudo/repos","events_url":"https://api.github.com/users/bgribaudo/events{/privacy}","received_events_url":"https://api.github.com/users/bgribaudo/received_events","type":"User","site_admin":false},"repo":{"id":36816126,"node_id":"MDEwOlJlcG9zaXRvcnkzNjgxNjEyNg==","name":"corefx","full_name":"bgribaudo/corefx","owner":{"login":"bgribaudo","id":857202,"node_id":"MDQ6VXNlcjg1NzIwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/857202?v=4","gravatar_id":"","url":"https://api.github.com/users/bgribaudo","html_url":"https://github.com/bgribaudo","followers_url":"https://api.github.com/users/bgribaudo/followers","following_url":"https://api.github.com/users/bgribaudo/following{/other_user}","gists_url":"https://api.github.com/users/bgribaudo/gists{/gist_id}","starred_url":"https://api.github.com/users/bgribaudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgribaudo/subscriptions","organizations_url":"https://api.github.com/users/bgribaudo/orgs","repos_url":"https://api.github.com/users/bgribaudo/repos","events_url":"https://api.github.com/users/bgribaudo/events{/privacy}","received_events_url":"https://api.github.com/users/bgribaudo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bgribaudo/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/bgribaudo/corefx","forks_url":"https://api.github.com/repos/bgribaudo/corefx/forks","keys_url":"https://api.github.com/repos/bgribaudo/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bgribaudo/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bgribaudo/corefx/teams","hooks_url":"https://api.github.com/repos/bgribaudo/corefx/hooks","issue_events_url":"https://api.github.com/repos/bgribaudo/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/bgribaudo/corefx/events","assignees_url":"https://api.github.com/repos/bgribaudo/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/bgribaudo/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/bgribaudo/corefx/tags","blobs_url":"https://api.github.com/repos/bgribaudo/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bgribaudo/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bgribaudo/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/bgribaudo/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bgribaudo/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/bgribaudo/corefx/languages","stargazers_url":"https://api.github.com/repos/bgribaudo/corefx/stargazers","contributors_url":"https://api.github.com/repos/bgribaudo/corefx/contributors","subscribers_url":"https://api.github.com/repos/bgribaudo/corefx/subscribers","subscription_url":"https://api.github.com/repos/bgribaudo/corefx/subscription","commits_url":"https://api.github.com/repos/bgribaudo/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/bgribaudo/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/bgribaudo/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/bgribaudo/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/bgribaudo/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/bgribaudo/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bgribaudo/corefx/merges","archive_url":"https://api.github.com/repos/bgribaudo/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bgribaudo/corefx/downloads","issues_url":"https://api.github.com/repos/bgribaudo/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/bgribaudo/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/bgribaudo/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/bgribaudo/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bgribaudo/corefx/labels{/name}","releases_url":"https://api.github.com/repos/bgribaudo/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/bgribaudo/corefx/deployments","created_at":"2015-06-03T16:27:39Z","updated_at":"2015-06-03T16:27:57Z","pushed_at":"2018-08-28T20:17:03Z","git_url":"git://github.com/bgribaudo/corefx.git","ssh_url":"git@github.com:bgribaudo/corefx.git","clone_url":"https://github.com/bgribaudo/corefx.git","svn_url":"https://github.com/bgribaudo/corefx","homepage":"","size":178425,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"5ab0d37bf7d0c27ea2c12662bee08dd99f8f0530","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"node_id":"MDEwOlJlcG9zaXRvcnkyNjI5NTM0NQ==","name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2018-08-28T20:54:39Z","pushed_at":"2018-08-28T20:31:46Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"https://github.com/dotnet/core","size":186374,"stargazers_count":14686,"watchers_count":14686,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4271,"mirror_url":null,"archived":false,"open_issues_count":2535,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4271,"open_issues":2535,"watchers":14686,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/31827"},"html":{"href":"https://github.com/dotnet/corefx/pull/31827"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/31827"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/31827/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/31827/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/31827/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/d47ea5713dee7f629cf7478d5f1650536667552f"}},"author_association":"NONE"}}
{"actor":{"display_login":"danmosemsft"}}