Skip to content

Commit

Permalink
Prevent creating new console on Windows
Browse files Browse the repository at this point in the history
When running Jupyter via pythonw e.g. pythonw -m qtconsole, jupyter_client launches new kernel via python.exe which is a console application on Windows - a side-effect of that is a new empty console window created and shown as long as kernel is running.

This patch adds CREATE_NO_WINDOW 0x08000000 to Windows specific creationflags. This flag is not exported by subprocess module therefore has to be provides numerically.
  • Loading branch information
nanoant authored and AdamVarian committed Apr 12, 2018
1 parent 3058347 commit bf57d23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jupyter_client/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None,
DUPLICATE_SAME_ACCESS)
env['JPY_PARENT_PID'] = str(int(handle))

# Prevent creating new console window on pythonw
if redirect_out:
kwargs['creationflags'] = kwargs.setdefault('creationflags', 0) | 0x08000000 # CREATE_NO_WINDOW

else:
# Create a new session.
# This makes it easier to interrupt the kernel,
Expand Down

0 comments on commit bf57d23

Please sign in to comment.