Skip to content

Commit

Permalink
Merge pull request #752 from minrk/optional-capture-fd
Browse files Browse the repository at this point in the history
Add IPKernelApp.capture_fd_output config to disable FD-level capture
  • Loading branch information
blink1073 authored Aug 26, 2021
2 parents abefee4 + effad5a commit 54b4d8f
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 54b4d8f

Please sign in to comment.