Skip to content

Terminal windows are closed whenever updated from the store #3915

Closed

Description

On several occasions I've experienced that when I leave my computer for a while and come back, all my terminal windows are gone.
After some investigation I've reached the conclusion that this happens because the app was installed through the Microsoft store, and just received an update.

This is probably fine for your average note taking app or Candy Crush game, but for a terminal with several tabs open that do actual work (and perhaps even long-running (like several days) processes open in remote SSH sessions) this is completely unacceptable.

Is there a way to avoid the terminal being restarted after receiving an update through the Store? A notification would be fine to let me know that I should restart it on the earliest convenient moment, but having it just disappear can in the worst case scenario cost me days of work that will need to be restarted, and in the best case some inconvenience and a few minutes to get back to where I was before...

Luckily a workaround exists: disable apps auto-updating (https://support.microsoft.com/en-us/help/15081/windows-turn-on-automatic-app-updates), but is there really no better way of handling this?

Environment

Windows build number: [Version 10.0.18362.418]
Windows Terminal version (if applicable): 0.7.3382.0

Steps to reproduce

Do normal everyday work in terminal, wait for an update to arrive.

Expected behavior

A notification to restart the app at my earliest convenience, or that the app continues to run with the old version, and that all new instances are started as the new version (like in Linux, where executables linger on in RAM until closed regardless of whether the file they started from still exist).
Or at the very least that it would notify me that new updates were available, but not install them.

Actual behavior

Terminal windows suddenly disappear with no explanation whatsoever, before I open the Store app and see that it was just now updated...

Sorry if this issue seems a bit salty, but it's really annoying - right up there with getting to the office in the morning to continue where you left off yesterday, only to find out that the PC rebooted automatically to install Windows updates (hint: not cool).

Activity

  1. ghost added
    Needs-Triage
    on Dec 11, 2019
  2. ghost added
    Needs-Tag-Fix
    on Dec 11, 2019
  3. tovine commented on Dec 11, 2019

    @tovine
    Author

    Actually, the way you're doing it for Visual Studio Code is perfect - why not use the same approach here if possible? :)

  4. mg-christian-esser commented on Dec 13, 2019

    @mg-christian-esser

    +1 I just lost hours worth of state because of this behavior.

  5. removed
    Needs-Triage
    on Dec 19, 2019
  6. bozhodimitrov commented on Jan 9, 2020

    @bozhodimitrov

    The other way around is also not good.
    Previously I had a lot of errors in my Event Viewer from Windows Update about the fact that Windows Terminal can't be updated, because the executable is running.
    We need a better process of updating the app. And it would be nice if we have some kind of configuration options like: automatic restart after update - on/off and so on :)

  7. mg-christian-esser commented on Jan 14, 2020

    @mg-christian-esser

    Just having automatic updates install upon next launch would be a perfectly fine behavior.

  8. CaptFrankSolo commented on Feb 15, 2020

    @CaptFrankSolo

    Also note, there is a massive difference in these experiences:

    1. windows restarts while my console apps are running and all my terminal state is lost AND my enqueued commands for long-running operations to finish while i am sleeping are in an unknown state
    2. windows restarts for updates after my enqueued commands finish and all my terminal state is lost
    3. windows waits to restart before my enqueued commands finish and restarts terminals with the same windows open
    4. windows waits to restart before my enqueued commands finish, and upon restart, terminal relaunches to to the exact same display state
    5. windows waits to restart before my enqueued commands finish, and upon restart, terminal relaunches to to the exact same display state including command history

    please, on behalf of developers everywhere with long build times, consider moving us more and more to #5

  9. emusgrave commented on May 18, 2020

    @emusgrave

    Dustin L. Howett (MSFT) (@DHowett-MSFT) I see that you've mentioned this issue from other closed issues but you have not actually commented here regarding the problem or the intention to fix it. I was about to open a new report because this issue also doesn't capture the entire story. But instead I'll post some findings here and hope that you can shed some more light on what the plans are.

    First, the problem is not just that the console sessions are silently closed when the program automatically updates. I haven't been able to fully trace what set of circumstances causes this, but I've had processes just get orphaned. The only reason I even realize this is that when I go to re-open one of my command line processes, I see that the listening port is still in use and I can't open it. I've then had to go searching through TCPView and Process Explorer to find the orphaned process and kill it.

    Second, I tried to circumvent all of this by installing the Terminal app via Chocolatey. However, it still gets updated via the Windows Store!? I'm not sure why that would happen if I did not install via the Store.

    At the very least I would LOVE an option to disable automatic updates. Another solution might be to tie all updates to Terminal to the next Windows reboot cycle? But I think from your comments on other threads this is what you aren't able to do when distributing via the Store.

    I would also make the recommendation to just not distribute this application on the Windows Store. This is not really an ideal app for that delivery mechanism. This is a power user / developer targeted app, so I would think it would be distributed more like Visual Studio or Visual Studio Code, or even Power Toys.

    Thanks for your teams work on this app. Unfortunately I am going to have to abandon it until this issue is fixed because I'm losing a lot of time and work every other week when an update is pushed and my long-running processes are lost.

  10. DHowett commented on May 18, 2020

    @DHowett
    Member

    You've got the critical points down pat.

    For right now, it's possible to extract the msixbundle (and the architecture-specific msix inside it) and run WindowsTerminal.exe directly. We're not intending on breaking this. 🤞

  11. emusgrave commented on May 18, 2020

    @emusgrave

    Dustin L. Howett (@DHowett) Thank you for the quick response!

    I went ahead and uninstalled my existing copy of Terminal (thereby unlinking it from the Windows Store), and am now running it directly from the exe extracted from the package you referred to. Appears to work the same, although the version number in the about box is listed as 0.11.200512003-release1.0.

    Hopefully this helps some others who are struggling with the automatic updates. I will keep an eye on the repo so that I can perform my own updates manually.

  12. sba923 commented on Jul 27, 2020

    @sba923

    Dustin L. Howett (@DHowett) Thank you for the quick response!

    I went ahead and uninstalled my existing copy of Terminal (thereby unlinking it from the Windows Store), and am now running it directly from the exe extracted from the package you referred to. Appears to work the same, although the version number in the about box is listed as 0.11.200512003-release1.0.

    Hopefully this helps some others who are struggling with the automatic updates. I will keep an eye on the repo so that I can perform my own updates manually.

    So you did not install from the msixbundle available from the 'Releases' page?

    That's what I just did, and how Store reports the app is 'installed'... so I expect it will still be subject to (auto)updates. Correct?

    Can you please elaborate on how you got a runnable instance deployed without Store considering it's installed (and thus needs updating)?

    TIA

  13. emusgrave commented on Jul 28, 2020

    @emusgrave

    Stéphane BARIZIEN (@sba923) You can "unzip" the msixbundle, and then just run the exe from there. I copied the folder to Program Files and added it to my PATH env for extra convenience.

    I have had no problems with auto-updates since doing it this way. I watch the github project for any releases that have fixes/features that I want.

  14. sba923 commented on Jul 28, 2020

    @sba923

    Stéphane BARIZIEN (@sba923) You can "unzip" the msixbundle, and then just run the exe from there. I copied the folder to Program Files and added it to my PATH env for extra convenience.

    I have had no problems with auto-updates since doing it this way. I watch the github project for any releases that have fixes/features that I want.

    Thanks for the tip!

    I chose not to add the folder to the PATH, because that's not absolutely required (and I have a theory where adding tons of app folders to the PATH would slow down the system...).

    Something worth mentioning: uninstalling will delete %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState where the settings.json file is located (I know, that's part of the "good" sandboxing idea beyond store app deployment), so you'll lose your settings if you don't make a copy first.

    In the "XCOPY-deployed" instance, the settings.json file resides at %LOCALAPPDATA%\Microsoft\Windows Terminal.

    HTH

  15. 2 remaining items

  16. RowdyChildren commented on Feb 13, 2021

    @RowdyChildren
    Member

    Seeing this issue as well, its very annoying.

  17. aaroneg commented on Feb 14, 2021

    @aaroneg
  18. DHowett commented on Feb 14, 2021

    @DHowett
  19. DHowett commented on Feb 14, 2021

    @DHowett
  20. locked as too heated and limited conversation to collaborators on Feb 14, 2021
  21. added
    Product-Terminal
    Tracking-External
    on Feb 16, 2021
  22. removed
    Needs-Tag-Fix
    on Apr 19, 2022
  23. added a commit that references this issue on Nov 1, 2023
    1f48cd9
  24. added
    In-PR
    on Nov 1, 2023
  25. added a commit that references this issue on Nov 7, 2023
    077d63e
  26. added a commit that references this issue on Nov 13, 2023
    2ac5e86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

In-PRProduct-TerminalTracking-External

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions