vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

PowerShell Integrated Console appears to start twice

Open rkeithhill opened this issue 8 years ago • 12 comments

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.

rkeithhill avatar Mar 23 '17 01:03 rkeithhill

VS Code is doing this, here's the issue I filed against them about it: https://github.com/Microsoft/vscode/issues/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.

daviwil avatar Mar 23 '17 02:03 daviwil

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.

jmiller76 avatar Oct 31 '17 18:10 jmiller76

Now that https://github.com/Microsoft/vscode/issues/13267 is closed, can we revisit this? It is super annoying still...

JustinGrote avatar Aug 20 '18 22:08 JustinGrote

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

rjmholt avatar Mar 17 '20 18:03 rjmholt

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

JustinGrote avatar Mar 17 '20 20:03 JustinGrote

@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

JustinGrote avatar Mar 18 '20 19:03 JustinGrote

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

TylerLeonhardt avatar Mar 18 '20 19:03 TylerLeonhardt

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 https://github.com/microsoft/vscode/issues/13267

JustinGrote avatar Mar 18 '20 19:03 JustinGrote

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.

TylerLeonhardt avatar Mar 18 '20 19:03 TylerLeonhardt

Related issue that was abandoned. https://github.com/microsoft/vscode/issues/39137

Here's a workaround script maybe that can be integrated https://github.com/microsoft/vscode/issues/39137#issuecomment-414127477

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.) https://github.com/microsoft/vscode/issues/39137#issuecomment-539584642

JustinGrote avatar Mar 18 '20 19:03 JustinGrote

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.

aproposts avatar Jul 05 '23 16:07 aproposts

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

andyleejordan avatar Jul 05 '23 16:07 andyleejordan