mirror of
https://github.com/davidhalter/jedi.git
synced 2026-03-01 17:26:51 +08:00
Remove stdout/stderr from subprocesses (redirected to /dev/null)
This means that the subprocess should now not crash anymore because of people writing to stdout in c modules and stderr should be empty. Fixes #793.
This commit is contained in:
@@ -142,7 +142,6 @@ class _CompiledSubprocess(object):
|
||||
args,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
# stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
def run(self, evaluator, function, args=(), kwargs={}):
|
||||
@@ -266,6 +265,11 @@ class Listener(object):
|
||||
|
||||
def listen(self):
|
||||
stdout = sys.stdout
|
||||
# Mute stdout/stderr. Nobody should actually be able to write to those,
|
||||
# because stdout is used for IPC and stderr will just be annoying if it
|
||||
# leaks (on module imports).
|
||||
sys.stdout = open(os.devnull, 'w')
|
||||
sys.stderr = open(os.devnull, 'w')
|
||||
stdin = sys.stdin
|
||||
if sys.version_info[0] > 2:
|
||||
stdout = stdout.buffer
|
||||
|
||||
Reference in New Issue
Block a user