Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IPKernelApp.capture_fd_output config to disable FD-level capture #752

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ipykernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import signal
import traceback
import logging
from functools import partial
from io import TextIOWrapper, FileIO
from logging import StreamHandler

Expand Down Expand Up @@ -162,6 +163,12 @@ def abs_connection_file(self):
displayhook_class = DottedObjectName('ipykernel.displayhook.ZMQDisplayHook',
help="The importstring for the DisplayHook factory").tag(config=True)

capture_fd_output = Bool(
True,
help="""Attempt to capture and forward low-level output, e.g. produced by Extension libraries.
""",
).tag(config=True)

# polling
parent_handle = Integer(int(os.environ.get('JPY_PARENT_PID') or 0),
help="""kill this process if its parent dies. On Windows, the argument
Expand Down Expand Up @@ -413,6 +420,9 @@ def init_io(self):
e_stdout = None if self.quiet else sys.__stdout__
e_stderr = None if self.quiet else sys.__stderr__

if not self.capture_fd_output:
outstream_factory = partial(outstream_factory, watchfd=False)

sys.stdout = outstream_factory(self.session, self.iopub_thread,
'stdout',
echo=e_stdout)
Expand Down