Skip to content

Commit 1d807c2

Browse files
authored
Merge pull request #408 from minrk/close-fds-windows
set close_fds=False when starting kernels on Windows
2 parents 50ddc22 + 7a46b6b commit 1d807c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

jupyter_client/launcher.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None,
101101
except:
102102
from _subprocess import DuplicateHandle, GetCurrentProcess, \
103103
DUPLICATE_SAME_ACCESS, CREATE_NEW_PROCESS_GROUP
104-
# Launch the kernel process
104+
105+
# create a handle on the parent to be inherited
105106
if independent:
106107
kwargs['creationflags'] = CREATE_NEW_PROCESS_GROUP
107108
else:
@@ -115,6 +116,11 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None,
115116
if redirect_out:
116117
kwargs['creationflags'] = kwargs.setdefault('creationflags', 0) | 0x08000000 # CREATE_NO_WINDOW
117118

119+
# Avoid closing the above parent and interrupt handles.
120+
# close_fds is True by default on Python >=3.7
121+
# or when no stream is captured on Python <3.7
122+
# (we always capture stdin, so this is already False by default on <3.7)
123+
kwargs['close_fds'] = False
118124
else:
119125
# Create a new session.
120126
# This makes it easier to interrupt the kernel,

0 commit comments

Comments
 (0)