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
a7e988d5
Commit
a7e988d5
authored
Oct 19, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix defaults for close_fds on windows
parent
3fb4d1e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
gevent/subprocess.py
gevent/subprocess.py
+18
-11
greentest/test__all__.py
greentest/test__all__.py
+4
-2
No files found.
gevent/subprocess.py
View file @
a7e988d5
...
...
@@ -295,12 +295,13 @@ else:
raise
ex
return
output
_PLATFORM_DEFAULT_CLOSE_FDS
=
object
()
class
Popen
(
object
):
def
__init__
(
self
,
args
,
bufsize
=
None
,
executable
=
None
,
stdin
=
None
,
stdout
=
None
,
stderr
=
None
,
preexec_fn
=
None
,
close_fds
=
None
,
shell
=
False
,
preexec_fn
=
None
,
close_fds
=
_PLATFORM_DEFAULT_CLOSE_FDS
,
shell
=
False
,
cwd
=
None
,
env
=
None
,
universal_newlines
=
False
,
startupinfo
=
None
,
creationflags
=
0
,
threadpool
=
None
,
**
kwargs
):
...
...
@@ -323,19 +324,18 @@ class Popen(object):
if
not
isinstance
(
bufsize
,
integer_types
):
raise
TypeError
(
"bufsize must be an integer"
)
if
close_fds
is
None
:
# close_fds has different defaults on Py3/Py2
if
PY3
:
close_fds
=
True
else
:
close_fds
=
False
if
mswindows
:
if
preexec_fn
is
not
None
:
raise
ValueError
(
"preexec_fn is not supported on Windows "
"platforms"
)
if
close_fds
and
(
stdin
is
not
None
or
stdout
is
not
None
or
stderr
is
not
None
):
any_stdio_set
=
(
stdin
is
not
None
or
stdout
is
not
None
or
stderr
is
not
None
)
if
close_fds
is
_PLATFORM_DEFAULT_CLOSE_FDS
:
if
any_stdio_set
:
close_fds
=
False
else
:
close_fds
=
True
elif
close_fds
and
any_stdio_set
:
raise
ValueError
(
"close_fds is not supported on Windows "
"platforms if you redirect stdin/stdout/stderr"
)
if
threadpool
is
None
:
...
...
@@ -344,6 +344,13 @@ class Popen(object):
self
.
_waiting
=
False
else
:
# POSIX
if
close_fds
is
_PLATFORM_DEFAULT_CLOSE_FDS
:
# close_fds has different defaults on Py3/Py2
if
PY3
:
close_fds
=
True
else
:
close_fds
=
False
if
pass_fds
and
not
close_fds
:
import
warnings
warnings
.
warn
(
"pass_fds overriding close_fds."
,
RuntimeWarning
)
...
...
@@ -768,7 +775,7 @@ class Popen(object):
# Retain the process handle, but close the thread handle
self
.
_handle
=
hp
self
.
pid
=
pid
ht
.
Close
()
_winapi
.
CloseHandle
(
ht
)
if
not
hasattr
(
ht
,
'Close'
)
else
ht
.
Close
()
def
_internal_poll
(
self
):
"""Check if child process has terminated. Returns returncode
...
...
greentest/test__all__.py
View file @
a7e988d5
...
...
@@ -38,7 +38,9 @@ NOT_IMPLEMENTED = {
}
COULD_BE_MISSING
=
{
'socket'
:
[
'create_connection'
,
'RAND_add'
,
'RAND_egd'
,
'RAND_status'
]}
'socket'
:
[
'create_connection'
,
'RAND_add'
,
'RAND_egd'
,
'RAND_status'
],
'subprocess'
:
[
'_posixsubprocess'
],
}
NO_ALL
=
[
'gevent.threading'
,
'gevent._util'
,
'gevent._socketcommon'
,
...
...
@@ -83,7 +85,7 @@ class Test(unittest.TestCase):
for
name
in
self
.
__implements__
+
self
.
__imports__
:
if
name
in
self
.
stdlib_all
:
continue
if
name
in
COULD_BE_MISSING
.
get
(
self
.
stdlib_name
,
[]
):
if
name
in
COULD_BE_MISSING
.
get
(
self
.
stdlib_name
,
()
):
continue
if
name
in
dir
(
self
.
stdlib_module
):
# like thread._local which is not in thread.__all__
continue
...
...
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