Open
Description
Problem Overview
When using MSYS2 with ConPTY
enabled (MSYS=enable_pcon
), Python processes that are launched indirectly (as grandchild processes) continue running even after closing the mintty
terminal window. However, when using WinPTY
as a wrapper (winpty command
), these processes terminate correctly.
This particularly affects Python applications that set up network services or long-running processes with this hierarchy:
mintty → executable.exe → python.exe (python_script.py)
Environment
- MSYS2 runtime version:
3.5.7-4
- Windows version:
10.0.19045
- Environment:
CLANG64
- ConPTY: Enabled (
MSYS=enable_pcon
) - Terminal:
mintty
Steps to Reproduce
- Create a simple Python network service script:
# server.py
import socket
import time
import sys
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('localhost', 8000))
server.listen(5)
print("Server running on port 8000")
while True:
time.sleep(1)
- Run it via a wrapper script or entry point executable.
- Close the mintty terminal window by clicking the X button.
- Observe that the Python process continues running in the background (visible in Task Manager or by trying to start another server on the same port).
- Try the same with
winpty server.exe
- this correctly terminates all processes.
Expected Behavior
When closing the mintty
terminal window, all child processes (including Python processes) should terminate.
Actual Behavior
The parent process terminates, but the child Python process remains running in the background, keeping network ports open.
Metadata
Metadata
Assignees
Labels
No labels