Allow timeout to kill entire process tree.
authorTamar Christina <tamar@zhox.com>
Fri, 23 Dec 2016 00:56:34 +0000 (00:56 +0000)
committerTamar Christina <tamar@zhox.com>
Fri, 23 Dec 2016 11:56:08 +0000 (11:56 +0000)
commitefc4a1661f0fc1004a4b7b0914f3d3a08c2e791a
treeca0ad8d41cbc829ab8d1b7a86861affd8c5d565f
parentb7a6e6220289289796d03cf1738e6c77daf6c181
Allow timeout to kill entire process tree.

Summary:
we spawn the child processes with handle inheritance on. So they inherit the std handles.
The problem is that the job handle gets inherited too.
So the `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` doesn't get used since there are
open handles to the job in the children.

We then terminate the top level process which is `sh` but leaves the children around.

This explicitly disallows the inheritance of the job and events handle.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

Differential Revision: https://phabricator.haskell.org/D2895

GHC Trac Issues: #13004
testsuite/timeout/WinCBindings.hsc
testsuite/timeout/timeout.hs