Skip to content

PR: Prevent subprocess.Popen calls to create visible consoles on Windows. #4992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 20, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion spyder/utils/site/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,27 @@ def execfile(filename, namespace):
HAS_CYTHON = False


#==============================================================================
# Prevent subprocess.Popen calls to create visible console windows on Windows.
# See issue #4932
#==============================================================================

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove blank

import subprocess

if os.name == 'nt':
creation_flag = 0x08000000 # CREATE_NO_WINDOW
else:
creation_flag = 0 # Default value


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove blank

class SubprocessPopen(subprocess.Popen):
def __init__(self, *args, creationflags=0, **kwargs):
super(SubprocessPopen, self).__init__(
*args, creationflags=creation_flag, **kwargs)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove blank

subprocess.Popen = SubprocessPopen

#==============================================================================
# Importing user's sitecustomize
#==============================================================================
Expand Down Expand Up @@ -227,7 +248,6 @@ def _getfilesystemencoding_wrapper():
except:
pass


#==============================================================================
# This prevents a kernel crash with the inline backend in our IPython
# consoles on Linux and Python 3 (Fixes Issue 2257)
Expand Down