[Request] [+ ] D8657: procutil: make recent fix for zombies compatible with py2

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jun 25 07:13:35 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The fix in ed684a82e29b <https://phab.mercurial-scm.org/rHGed684a82e29bbea8556c3079f6159a9159689078> (procutil: always waiting on child processes
  to prevent zombies with 'hg serve', 2020-05-07) works only on Python 3
  because it passes a `daemon` argument to `threading.Thread()`. Python
  2 requires you to assign to the `.daemon` property instead. Python 3
  also seems to support that, so this patch fixes the code by
  unconditionally using the old form.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8657

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -615,7 +615,9 @@
                     def _do_wait():
                         os.waitpid(pid, 0)
 
-                    threading.Thread(target=_do_wait, daemon=True).start()
+                    t = threading.Thread(target=_do_wait)
+                    t.daemon = True
+                    t.start()
                     return
                 # Parent process
                 (_pid, status) = os.waitpid(pid, 0)



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200625/235afeab/attachment.html>


More information about the Mercurial-patches mailing list