forked from VimPlug/jedi
Better error handling for subprocesses
I don't really understand why this wasn't an issue before, but it looks like we have to catch both IOError and and socket.error in Python2.
This commit is contained in:
@@ -16,7 +16,8 @@ import weakref
|
|||||||
import traceback
|
import traceback
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from jedi._compatibility import queue, is_py3, force_unicode, pickle_dump, pickle_load
|
from jedi._compatibility import queue, is_py3, force_unicode, \
|
||||||
|
pickle_dump, pickle_load
|
||||||
from jedi.cache import memoize_method
|
from jedi.cache import memoize_method
|
||||||
from jedi.evaluate.compiled.subprocess import functions
|
from jedi.evaluate.compiled.subprocess import functions
|
||||||
from jedi.evaluate.compiled.access import DirectObjectAccess, AccessPath, \
|
from jedi.evaluate.compiled.access import DirectObjectAccess, AccessPath, \
|
||||||
@@ -184,10 +185,10 @@ class _CompiledSubprocess(object):
|
|||||||
kwargs = {force_unicode(key): value for key, value in kwargs.items()}
|
kwargs = {force_unicode(key): value for key, value in kwargs.items()}
|
||||||
|
|
||||||
data = evaluator_id, function, args, kwargs
|
data = evaluator_id, function, args, kwargs
|
||||||
pickle_dump(data, self._process.stdin)
|
|
||||||
try:
|
try:
|
||||||
|
pickle_dump(data, self._process.stdin)
|
||||||
self._process.stdin.flush()
|
self._process.stdin.flush()
|
||||||
except socket.error as e:
|
except (socket.error, IOError) as e:
|
||||||
# Once Python2 will be removed we can just use `BrokenPipeError`.
|
# Once Python2 will be removed we can just use `BrokenPipeError`.
|
||||||
if e.errno != errno.EPIPE:
|
if e.errno != errno.EPIPE:
|
||||||
# Not a broken pipe
|
# Not a broken pipe
|
||||||
|
|||||||
Reference in New Issue
Block a user