Skip to content

Commit effad5a

Browse files
committed
Add IPKernelApp.capture_fd_output config to disable FD-level capture
allows opting out of the new behavior, if so desired
1 parent abefee4 commit effad5a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ipykernel/kernelapp.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import signal
1111
import traceback
1212
import logging
13+
from functools import partial
1314
from io import TextIOWrapper, FileIO
1415
from logging import StreamHandler
1516

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

166+
capture_fd_output = Bool(
167+
True,
168+
help="""Attempt to capture and forward low-level output, e.g. produced by Extension libraries.
169+
""",
170+
).tag(config=True)
171+
165172
# polling
166173
parent_handle = Integer(int(os.environ.get('JPY_PARENT_PID') or 0),
167174
help="""kill this process if its parent dies. On Windows, the argument
@@ -413,6 +420,9 @@ def init_io(self):
413420
e_stdout = None if self.quiet else sys.__stdout__
414421
e_stderr = None if self.quiet else sys.__stderr__
415422

423+
if not self.capture_fd_output:
424+
outstream_factory = partial(outstream_factory, watchfd=False)
425+
416426
sys.stdout = outstream_factory(self.session, self.iopub_thread,
417427
'stdout',
418428
echo=e_stdout)

0 commit comments

Comments
 (0)