Skip to content

PowerShell Integrated Console appears to start twice #604

Closed

Description

System Details

  • Operating system name and version: Windows 10 AU
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.11.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.14393.953
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.953
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When I open a PS workspace in VSCode the first time, the integrated console appears to load twice:
pses-ic-startup
I also notice that the first time, it displays the logo but then the screen is cleared and it says it's starting PowerShell again. Is this the new host that loads the second time? If so, maybe it could say Starting the PowerShell Integrated Console...? If we can't prevent the first (original) load, we may want to see if we can start PowerShell with -NoLogo. For the final load, do we want to show a logo? Perhaps with a setting to disable it?

Attached Logs

N/A I think. If that's not the case, let me know and I can attach them.

Activity

  1. daviwil commented on Mar 23, 2017

    @daviwil
    Contributor

    VS Code is doing this, here's the issue I filed against them about it: microsoft/vscode#22968

    Basically, when VS Code restarts, it remembers that a terminal was open when the window was closed the previous time and then launches the terminal UI using your default terminal preference just before I have a chance to start the integrated console. I have tried a few different ways of suppressing it but nothing has worked yet.

  2. jmiller76 commented on Oct 31, 2017

    @jmiller76

    Wouldn't a better process be to set something in terminal.integrated.shell.windows that would start the extension and the integrated terminal?

    This would set a user setting that would prevent accidently killing whatever other terminal may or may not be wanted. It would also be more efficient if the default powershell is loading with a profile.

  3. JustinGrote commented on Aug 20, 2018

    @JustinGrote
    Collaborator

    Now that microsoft/vscode#13267 is closed, can we revisit this? It is super annoying still...

  4. rjmholt commented on Mar 17, 2020

    @rjmholt
    Contributor

    It looks like this is no longer occurring. Closing this now, but can reopen if needed

  5. JustinGrote commented on Mar 17, 2020

    @JustinGrote
    Collaborator

    Can confirm, I just got so used to it happening that I never stopped to notice when it didn't happen. Cool beans!

  6. ghost added
    Needs: Maintainer Attention
    on Mar 17, 2020
  7. JustinGrote commented on Mar 18, 2020

    @JustinGrote
    Collaborator

    Rob Holt (@rjmholt) TylerLeonhardt Actually this is still an issue at least with "Reload Window" and should be reopened, I just didn't look closely enough.

    Steps to reproduce:

    1. Start window with Powershell Integrated Terminal
    2. Choose "Reload Window"
    3. A pwsh terminal in addition to integrated terminal will be started.

    Expected behavior

    Only the Powershell Integrated Terminal should be started upon a reload window if it was the only terminal open previously.
    Capture

  8. ghost added
    Needs: Maintainer Attention
    on Mar 18, 2020
  9. TylerLeonhardt commented on Mar 18, 2020

    @TylerLeonhardt
    Member

    ah I see... that's because the Terminal pane is open and by default it opens your default shell...

  10. JustinGrote commented on Mar 18, 2020

    @JustinGrote
    Collaborator

    ah I see... that's because the Terminal pane is open and by default it opens your default shell...

    Correct, in the past there was nothing you could do about it, but you should be able to now with microsoft/vscode#13267

  11. TylerLeonhardt commented on Mar 18, 2020

    @TylerLeonhardt
    Member

    Yeah but... I don't know if we want to mess with other terminals... could be dangerous. The user might have been already running something in that other terminal.

  12. JustinGrote commented on Mar 18, 2020

    @JustinGrote
    Collaborator

    Related issue that was abandoned.
    microsoft/vscode#39137

    Here's a workaround script maybe that can be integrated
    microsoft/vscode#39137 (comment)

    EDIT: Also a dispose API for terminals if we can establish some safe parameters (e.g. Extension has just started on startup/reload, Integrated Console was open previously, new terminal is less than 5 seconds old, etc.)
    microsoft/vscode#39137 (comment)

  13. aproposts commented on Jul 5, 2023

    @aproposts

    This is still feels like it should be fixed by the vscode team. The argument that they're restoring state doesn't track: If I didn't have a pwsh (or whatever) open in the Terminal tab when I closed the window, why is it being 'restored'?

    We're not the only ones complaining about this. I don't know if a new settings option would even be necessary: If I have both of the persist settings set as such:

      "terminal.integrated.persistentSessionReviveProcess": "never",
      "terminal.integrated.enablePersistentSessions": false,

    ...it's pretty clear I don't want the application opening a terminal for me. Regardless, I'll try to find some time to carefully read the open issue and make a persuasive argument.

  14. andyleejordan commented on Jul 5, 2023

    @andyleejordan
    Member

    We would definitely appreciate that, requests come best from the users themselves!

  15. andyleejordan commented on Jun 15, 2026

    @andyleejordan
    Member

    This appears to have been addressed in v2023.6.0 (June 2023), which refactored the client startup logic so a ghost Extension Terminal can't be created, and #4599 made sessionManager.start() idempotent so the session can't start twice. If you still see this on a current version, please comment with fresh repro steps and logs and we'll reopen.

    🤖 Drafted by GitHub Copilot at Andy Jordan (@andyleejordan)'s request — pending maintainer review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: VS Code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions