Child process exits earlier than on windows 10


wineleven_user

New member
Local time
4:52 PM
Posts
3
OS
Windows 10
I have a Python program that starts other programs using subprocess.Popen, and then exits. On windows 10, the other console programs started by my Python program keep running, and the console stays open until they are done. On windows 11, the other console programs terminate when my Python program terminates, and the console also closes.

I haven't been able to figure out why.

As a workaround, I've detected that the program is running on Windows 11 (another can of worms, since Windows 11 identifies as version 10), and switch to a waited version (subprocess.check_call). This workaround is rather annoying when non-console programs are started, as the console stays around unnecessarily.

Does anyone know what changed in Windows 11 to change this behavior?

I'm still running Windows 10, but others using my program are reporting these issues on Windows 11, so I can't be explicit about the Windows 11 Build, I think they are following the usual release upgrade path.
 

My Computer

System One

  • OS
    Windows 10
There's an advanced setting in Windows Terminal where you can tell it to "never close automatically." That usually works for me!
1677270914012.png
HTH,
--Ed--
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo X380 Yoga
    CPU
    i7-8650U (8th Gen/Kaby Lake)
    Motherboard
    20LH000MUS (U3E1)
    Memory
    16 GB
    Graphics Card(s)
    Intel UHD Graphics 620
    Sound Card
    Integrated Conexant SmartAudio HD
    Monitor(s) Displays
    FlexView Display
    Screen Resolution
    1920x1080
    Hard Drives
    Toshiba 1 TB PCIe x3 NVMe SSD
    external 5TB Seagate USB-C attached HDD
    PSU
    Lenovo integrated 65W power brick
    Case
    Laptop
    Cooling
    Laptop
    Keyboard
    Integrated Lenovo ThinkPad keyboard
    Mouse
    touchscreen, touchpad
    Internet Speed
    GbE (Spectrum/Charter)
    Browser
    all of em
    Antivirus
    Defender
    Other Info
    Purchased early 2019 as Windows Insider test PC
That's a promising lead, Ed. I've heard about Windows Terminal, but haven't experienced it. Reading now about all the profiles and settings.... I have a couple questions, if you are willing to answer...

So does starting a new console program (by clicking in File Explorer, or using the Start menu or Run — I'm assuming all three do the same?) create a new Windows Terminal window, or does it create a new Windows Terminal tab if there is already a window open?

So does starting a new console program from another console program already running in Windows Terminal use the same tab in the same window, or start a new tab or new window?

My guess is that there might be a setting for window or tab for the first question, and that it uses the same tab in the same window for the second question.

And that in the second situation it is too stupid to track that the child console program is still using it when the parent terminates, and so it shuts down the tab (and window if it is the only tab) when the first program exits, thus killing the second program. The old console kept track, and the console stuck around until no programs were using it.

It seems there should be one more setting in the Advanced Exit property.... keep tab open until all programs using it have exited.
 

My Computer

System One

  • OS
    Windows 10
By default it creates a new tab. To open a new instance, you're supposed to be able to run the wt.exe file. That works fine in Windows 11, as does a trip into the start menu with a right-click to "Run as administrator" on Terminal icon there.

But when I try to do that in Windows 10, I get an access denied error, even using the shift-left "Copy as path" full file specification. I see others are having the same problem.

Try those techniques, and let me know what you see.

HTH,
--Ed--
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo X380 Yoga
    CPU
    i7-8650U (8th Gen/Kaby Lake)
    Motherboard
    20LH000MUS (U3E1)
    Memory
    16 GB
    Graphics Card(s)
    Intel UHD Graphics 620
    Sound Card
    Integrated Conexant SmartAudio HD
    Monitor(s) Displays
    FlexView Display
    Screen Resolution
    1920x1080
    Hard Drives
    Toshiba 1 TB PCIe x3 NVMe SSD
    external 5TB Seagate USB-C attached HDD
    PSU
    Lenovo integrated 65W power brick
    Case
    Laptop
    Cooling
    Laptop
    Keyboard
    Integrated Lenovo ThinkPad keyboard
    Mouse
    touchscreen, touchpad
    Internet Speed
    GbE (Spectrum/Charter)
    Browser
    all of em
    Antivirus
    Defender
    Other Info
    Purchased early 2019 as Windows Insider test PC
Thanks for your help. This turns out to have been a bug in Windows Terminal, fixed in Preview 17, and hopefully sticks around in all future versions.
 

My Computer

System One

  • OS
    Windows 10
Back
Top Bottom