forked from VimPlug/jedi
Change subclass to function wrapper
This avoids mypy complaining that we need to provide a generic argument to Popen, which we cannot acctually do as the implementation of Popen does not inherit from typing.Generic.
This commit is contained in:
@@ -29,19 +29,19 @@ _MAIN_PATH = os.path.join(os.path.dirname(__file__), '__main__.py')
|
|||||||
PICKLE_PROTOCOL = 4
|
PICKLE_PROTOCOL = 4
|
||||||
|
|
||||||
|
|
||||||
class _GeneralizedPopen(subprocess.Popen):
|
def _GeneralizedPopen(*args, **kwargs):
|
||||||
def __init__(self, *args, **kwargs):
|
if os.name == 'nt':
|
||||||
if os.name == 'nt':
|
try:
|
||||||
try:
|
# Was introduced in Python 3.7.
|
||||||
# Was introduced in Python 3.7.
|
CREATE_NO_WINDOW = subprocess.CREATE_NO_WINDOW
|
||||||
CREATE_NO_WINDOW = subprocess.CREATE_NO_WINDOW
|
except AttributeError:
|
||||||
except AttributeError:
|
CREATE_NO_WINDOW = 0x08000000
|
||||||
CREATE_NO_WINDOW = 0x08000000
|
kwargs['creationflags'] = CREATE_NO_WINDOW
|
||||||
kwargs['creationflags'] = CREATE_NO_WINDOW
|
# The child process doesn't need file descriptors except 0, 1, 2.
|
||||||
# The child process doesn't need file descriptors except 0, 1, 2.
|
# This is unix only.
|
||||||
# This is unix only.
|
kwargs['close_fds'] = 'posix' in sys.builtin_module_names
|
||||||
kwargs['close_fds'] = 'posix' in sys.builtin_module_names
|
|
||||||
super().__init__(*args, **kwargs)
|
return subprocess.Popen(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def _enqueue_output(out, queue_):
|
def _enqueue_output(out, queue_):
|
||||||
|
|||||||
Reference in New Issue
Block a user