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 committed Jan 30, 2018
1 parent d1b08d6 commit a69bc5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jupyter_client/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None,
DUPLICATE_SAME_ACCESS, CREATE_NEW_PROCESS_GROUP
# Launch the kernel process
if independent:
kwargs['creationflags'] = CREATE_NEW_PROCESS_GROUP
kwargs['creationflags'] = CREATE_NEW_PROCESS_GROUP | 0x08000000 # CREATE_NO_WINDOW
else:
kwargs['creationflags'] = 0x08000000 # CREATE_NO_WINDOW
pid = GetCurrentProcess()
handle = DuplicateHandle(pid, pid, pid, 0,
True, # Inheritable by new processes.
Expand Down

0 comments on commit a69bc5c

Please sign in to comment.