Patchwork [2,of,2] run-tests: drop fallback for proc.terminate() for pre-py2.7

login
register
mail settings
Submitter via Mercurial-devel
Date May 16, 2017, 9:53 p.m.
Message ID <40067709292af7cca062.1494971600@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20645/
State Accepted
Headers show

Comments

via Mercurial-devel - May 16, 2017, 9:53 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1494970933 25200
#      Tue May 16 14:42:13 2017 -0700
# Node ID 40067709292af7cca062f2f88e3d808d28400df2
# Parent  e97e9dac1ede83367bdb494820276f67f0c8f269
run-tests: drop fallback for proc.terminate() for pre-py2.7
Yuya Nishihara - May 17, 2017, 1:06 p.m.
On Tue, 16 May 2017 14:53:20 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1494970933 25200
> #      Tue May 16 14:42:13 2017 -0700
> # Node ID 40067709292af7cca062f2f88e3d808d28400df2
> # Parent  e97e9dac1ede83367bdb494820276f67f0c8f269
> run-tests: drop fallback for proc.terminate() for pre-py2.7

Queued, thanks.
> 
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -523,10 +523,10 @@
>          sys.stdout.flush()
>  
>  def terminate(proc):
> -    """Terminate subprocess (with fallback for Python versions < 2.6)"""
> +    """Terminate subprocess"""

This one was "for pre-py2.6". Updated the commit message in flight.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -523,10 +523,10 @@ 
         sys.stdout.flush()
 
 def terminate(proc):
-    """Terminate subprocess (with fallback for Python versions < 2.6)"""
+    """Terminate subprocess"""
     vlog('# Terminating process %d' % proc.pid)
     try:
-        getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
+        proc.terminate()
     except OSError:
         pass