Avoid showing new windows on Windows (#1929)
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
This commit is contained in:
parent
6c098d8daa
commit
dc5eb79cfa
4 changed files with 7 additions and 6 deletions
1
docs/changelog/1928.bugfix.rst
Normal file
1
docs/changelog/1928.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Avoid spawning new windows when doing seed package upgrades in the background on Windows - by :user:`gaborbernat`.
|
||||
|
|
@ -22,7 +22,7 @@ from six.moves.urllib.request import urlopen
|
|||
from virtualenv.app_data import AppDataDiskFolder
|
||||
from virtualenv.info import PY2
|
||||
from virtualenv.util.path import Path
|
||||
from virtualenv.util.subprocess import DETACHED_PROCESS, Popen
|
||||
from virtualenv.util.subprocess import CREATE_NO_WINDOW, Popen
|
||||
|
||||
from ..wheels.embed import BUNDLE_SUPPORT
|
||||
from ..wheels.util import Wheel
|
||||
|
|
@ -186,7 +186,7 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, p
|
|||
pipe = None if debug else subprocess.PIPE
|
||||
kwargs = {"stdout": pipe, "stderr": pipe}
|
||||
if not debug and sys.platform == "win32":
|
||||
kwargs["creationflags"] = DETACHED_PROCESS
|
||||
kwargs["creationflags"] = CREATE_NO_WINDOW
|
||||
process = Popen(cmd, **kwargs)
|
||||
logging.info(
|
||||
"triggered periodic upgrade of %s%s (for python %s) via background process having PID %d",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ else:
|
|||
Popen = subprocess.Popen
|
||||
|
||||
|
||||
DETACHED_PROCESS = 0x00000008
|
||||
CREATE_NO_WINDOW = 0x80000000
|
||||
|
||||
|
||||
def run_cmd(cmd):
|
||||
|
|
@ -32,5 +32,5 @@ __all__ = (
|
|||
"subprocess",
|
||||
"Popen",
|
||||
"run_cmd",
|
||||
"DETACHED_PROCESS",
|
||||
"CREATE_NO_WINDOW",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from virtualenv.seed.wheels.periodic_update import (
|
|||
trigger_update,
|
||||
)
|
||||
from virtualenv.util.path import Path
|
||||
from virtualenv.util.subprocess import DETACHED_PROCESS
|
||||
from virtualenv.util.subprocess import CREATE_NO_WINDOW
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
@ -224,7 +224,7 @@ def test_trigger_update_no_debug(for_py_version, session_app_data, tmp_path, moc
|
|||
assert args == ([sys.executable, "-c", cmd],)
|
||||
expected = {"stdout": subprocess.PIPE, "stderr": subprocess.PIPE}
|
||||
if sys.platform == "win32":
|
||||
expected["creationflags"] = DETACHED_PROCESS
|
||||
expected["creationflags"] = CREATE_NO_WINDOW
|
||||
assert kwargs == expected
|
||||
assert process.communicate.call_count == 0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue