diff --git a/graphify/hooks.py b/graphify/hooks.py index b121b6896..84d3e9b85 100644 --- a/graphify/hooks.py +++ b/graphify/hooks.py @@ -215,7 +215,7 @@ def _bail(): # requires Python, so we let Python do the detaching: a tiny outer process spawns # the real rebuild fully detached and returns immediately, so the hook never # blocks. POSIX uses start_new_session (the setsid equivalent); Windows uses -# DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, breaking away from any job object +# CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP, breaking away from any job object # when allowed. This payload is carried inside a shell double-quoted -c argument, # so it deliberately uses only single-quoted Python strings (no ", $, ` or \\). _LAUNCHER_TEMPLATE = """\ @@ -232,7 +232,7 @@ def _bail(): _kw = dict(stdout=_out, stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL, cwd=os.getcwd(), close_fds=True) _cmd = [sys.executable, '-c', _src] if os.name == 'nt': - _flags = 0x00000008 | 0x00000200 # DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP + _flags = 0x08000000 | 0x00000200 # CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP try: subprocess.Popen(_cmd, creationflags=_flags | 0x01000000, **_kw) # + CREATE_BREAKAWAY_FROM_JOB except OSError: diff --git a/tests/test_hooks.py b/tests/test_hooks.py index 29acc9ead..18c2b59ce 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -248,10 +248,10 @@ def test_hooks_do_not_use_nohup(name, script): @pytest.mark.parametrize("name,script", _HOOK_SCRIPTS) def test_hooks_use_cross_platform_detach(name, script): """The replacement detaches via Python: start_new_session on POSIX and - DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP on Windows (#1161).""" + CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP on Windows (#1161 / #2253).""" assert "subprocess.Popen" in script assert "start_new_session=True" in script, f"{name} missing POSIX detach" - assert "0x00000008" in script, f"{name} missing Windows DETACHED_PROCESS flag" + assert "0x08000000" in script, f"{name} missing Windows CREATE_NO_WINDOW flag" assert "0x00000200" in script, f"{name} missing CREATE_NEW_PROCESS_GROUP flag"