From ea71dedaa1dee0ec8d59e217ee7f72b6678be4af Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 23 Jun 2018 11:37:43 +0200 Subject: [PATCH] Include stderr with "subprocess has crashed" exception (#1124) * Include stderr with "subprocess has crashed" exception This does not add it to the other similar exception raised from `kill`, since this should be something like "was killed already" anyway. * fixup! Include stderr with "subprocess has crashed" exception --- jedi/evaluate/compiled/subprocess/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/compiled/subprocess/__init__.py b/jedi/evaluate/compiled/subprocess/__init__.py index 89370476..0f8c328c 100644 --- a/jedi/evaluate/compiled/subprocess/__init__.py +++ b/jedi/evaluate/compiled/subprocess/__init__.py @@ -142,6 +142,7 @@ class _CompiledSubprocess(object): args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, # Use system default buffering on Python 2 to improve performance # (this is already the case on Python 3). bufsize=-1 @@ -203,9 +204,18 @@ class _CompiledSubprocess(object): try: is_exception, traceback, result = pickle_load(self._process.stdout) - except EOFError: + except EOFError as eof_error: + try: + stderr = self._process.stderr.read() + except Exception as exc: + stderr = '' % exc self.kill() - raise InternalError("The subprocess %s has crashed." % self._executable) + raise InternalError( + "The subprocess %s has crashed (%r, stderr=%s)." % ( + self._executable, + eof_error, + stderr, + )) if is_exception: # Replace the attribute error message with a the traceback. It's