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
6da9a8b5
Commit
6da9a8b5
authored
Oct 29, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gevent.subprocess: fix gevent.wait([Popen]) on Windows
parent
bb04dd39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
gevent/subprocess.py
gevent/subprocess.py
+22
-9
No files found.
gevent/subprocess.py
View file @
6da9a8b5
...
...
@@ -258,10 +258,6 @@ class Popen(object):
def
__repr__
(
self
):
return
'<%s at 0x%x pid=%r returncode=%r>'
%
(
self
.
__class__
.
__name__
,
id
(
self
),
self
.
pid
,
self
.
returncode
)
def
rawlink
(
self
,
callback
):
self
.
result
.
rawlink
(
linkproxy
(
callback
,
self
))
# XXX unlink
def
_on_child
(
self
,
watcher
):
watcher
.
stop
()
status
=
watcher
.
rstatus
...
...
@@ -309,6 +305,10 @@ class Popen(object):
def
poll
(
self
):
return
self
.
_internal_poll
()
def
rawlink
(
self
,
callback
):
self
.
result
.
rawlink
(
linkproxy
(
callback
,
self
))
# XXX unlink
if
mswindows
:
#
# Windows methods
...
...
@@ -472,18 +472,31 @@ class Popen(object):
if
self
.
returncode
is
None
:
if
WaitForSingleObject
(
self
.
_handle
,
0
)
==
WAIT_OBJECT_0
:
self
.
returncode
=
GetExitCodeProcess
(
self
.
_handle
)
self
.
result
.
set
(
self
.
returncode
)
return
self
.
returncode
def
_wait
(
self
):
def
rawlink
(
self
,
callback
):
if
not
self
.
result
.
ready
()
and
not
self
.
_waiting
:
self
.
_waiting
=
True
Greenlet
.
spawn
(
self
.
_wait
)
self
.
result
.
rawlink
(
linkproxy
(
callback
,
self
))
# XXX unlink
def
_blocking_wait
(
self
):
WaitForSingleObject
(
self
.
_handle
,
INFINITE
)
return
GetExitCodeProcess
(
self
.
_handle
)
self
.
returncode
=
GetExitCodeProcess
(
self
.
_handle
)
return
self
.
returncode
def
_wait
(
self
):
self
.
threadpool
.
spawn
(
self
.
_blocking_wait
).
rawlink
(
self
.
result
)
def
wait
(
self
,
timeout
=
None
):
"""Wait for child process to terminate. Returns returncode
attribute."""
if
not
self
.
_waiting
:
self
.
_waiting
=
True
self
.
threadpool
.
spawn
(
self
.
_wait
).
rawlink
(
self
.
result
)
if
self
.
returncode
is
None
:
if
not
self
.
_waiting
:
self
.
_waiting
=
True
self
.
_wait
()
return
self
.
result
.
wait
(
timeout
=
timeout
)
def
send_signal
(
self
,
sig
):
...
...
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