Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
a19097cb
Commit
a19097cb
authored
Sep 27, 2017
by
Jason Madden
Committed by
GitHub
Sep 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1025 from gevent/issue1023
More safely terminate process on Windows.
parents
1b6e4054
501e6ed3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
CHANGES.rst
CHANGES.rst
+3
-0
src/gevent/subprocess.py
src/gevent/subprocess.py
+16
-1
src/greentest/patched_tests_setup.py
src/greentest/patched_tests_setup.py
+0
-18
No files found.
CHANGES.rst
View file @
a19097cb
...
...
@@ -65,6 +65,9 @@
total speed up of about 35 times. It is now in the same ball park as
the native :class:`threading.local` class. See :pr:`1024`.
- More safely terminate process on Windows. Reported in :issue:`1023`
by Giacomo Debidda.
1.2.2 (2017-06-05)
==================
...
...
src/gevent/subprocess.py
View file @
a19097cb
...
...
@@ -108,6 +108,7 @@ __extra__ = [
'CreateProcess'
,
'INFINITE'
,
'TerminateProcess'
,
'STILL_ACTIVE'
,
# These were added for 3.5, but we make them available everywhere.
'run'
,
...
...
@@ -995,7 +996,21 @@ class Popen(object):
def
terminate
(
self
):
"""Terminates the process
"""
# Don't terminate a process that we know has already died.
if
self
.
returncode
is
not
None
:
return
try
:
TerminateProcess
(
self
.
_handle
,
1
)
except
OSError
as
e
:
# ERROR_ACCESS_DENIED (winerror 5) is received when the
# process already died.
if
e
.
winerror
!=
5
:
raise
rc
=
GetExitCodeProcess
(
self
.
_handle
)
if
rc
==
STILL_ACTIVE
:
raise
self
.
returncode
=
rc
self
.
result
.
set
(
self
.
returncode
)
kill
=
terminate
...
...
src/greentest/patched_tests_setup.py
View file @
a19097cb
...
...
@@ -171,14 +171,6 @@ disabled_tests = [
'test_thread.TestForkInThread.test_forkinthread'
,
# XXX needs investigating
'test_subprocess.POSIXProcessTestCase.test_terminate_dead'
,
'test_subprocess.POSIXProcessTestCase.test_send_signal_dead'
,
'test_subprocess.POSIXProcessTestCase.test_kill_dead'
,
# Don't exist in the test suite until 2.7.4+; with our monkey patch in place,
# they fail because the process they're looking for has been allowed to exit.
# Our monkey patch waits for the process with a watcher and so detects
# the exit before the normal polling mechanism would
'test_subprocess.POSIXProcessTestCase.test_preexec_errpipe_does_not_double_close_pipes'
,
# Does not exist in the test suite until 2.7.4+. Subclasses Popen, and overrides
# _execute_child. But our version has a different parameter list than the
...
...
@@ -529,16 +521,6 @@ if sys.version_info[:2] >= (3, 4):
# In any event, this test hangs forever
'test_subprocess.POSIXProcessTestCase.test_terminate_dead'
,
'test_subprocess.POSIXProcessTestCase.test_send_signal_dead'
,
'test_subprocess.POSIXProcessTestCase.test_kill_dead'
,
# With our monkey patch in place,
# they fail because the process they're looking for has been allowed to exit.
# Our monkey patch waits for the process with a watcher and so detects
# the exit before the normal polling mechanism would
'test_subprocess.POSIXProcessTestCase.test_preexec_errpipe_does_not_double_close_pipes'
,
# Subclasses Popen, and overrides _execute_child. Expects things to be done
# in a particular order in an exception case, but we don't follow that
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment