Skip to content

Commit

Permalink
Use CreateProcess from _subprocess on Python 2.7. Closes celery/celer…
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Aug 30, 2016
1 parent 5d17801 commit 2f28ead
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion billiard/popen_spawn_win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
#


if sys.platform == 'win32':
try:
from _winapi import CreateProcess
except ImportError: # Py2.7
from _subprocess import CreateProcess


class Popen(object):
'''
Start a subprocess to run the code of a process object
Expand All @@ -51,7 +58,7 @@ def __init__(self, process_obj):
with io.open(wfd, 'wb', closefd=True) as to_child:
# start process
try:
hp, ht, pid, tid = _winapi.CreateProcess(
hp, ht, pid, tid = CreateProcess(
spawn.get_executable(), cmd,
None, None, False, 0, None, None, None)
_winapi.CloseHandle(ht)
Expand Down
1 change: 0 additions & 1 deletion t/unit/test_win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def test_constants(self, name):
'TerminateProcess',
'DuplicateHandle',
'CreatePipe',
'CreateProcess',
])
def test_functions(self, name):
assert getattr(_winapi, name)

0 comments on commit 2f28ead

Please sign in to comment.