Vscode: Terminal is always launching externally when ConPTY is turned on

Created on 15 May 2019  ยท  31Comments  ยท  Source: microsoft/vscode

I can't get the terminal to launch integrated. It always launches externally.
More details in this StackOverflow question.

System Info
image

I'm not sure if this is a bug or user error.
Steps to Reproduce:

  1. Open vscode.
  2. Pres ctrl + ~.


Does this issue occur when all extensions are disabled?: Yes

Thanks for any help! ๐Ÿ‘

bug integrated-terminal integrated-terminal-conpty upstream windows

Most helpful comment

the solution for mee.
1 - Go to https://code.visualstudio.com/insiders/ and install Version: 1.35.0-insider
2 - Go to File/Preferences/Settings
3 - Search conPTY and disable --> Terminal โ€บ Integrated: Windows Enable Conpty

image

image

All 31 comments

Are you on Windows 10 Update 1903? I have the same problem on this build.

Are you on Windows 10 Update 1903? I have the same problem on this build.

Yes

image

Same issue here. I'm on 1903 as well. vscode 1.34.0

Can you share your settings.json file?

Fresh install. ๐Ÿ™‚

image

@GollyJer can you try with the Insiders build tomorrow? I made some changes just today around this area. https://code.visualstudio.com/insiders

@Tyriar Sure... I'll keep you posted. Thanks! ๐Ÿ‘

No change. Sorry.

image

Weird, I don't suppose you have anything in your keybindings.json either?

Does disabling the Windows Enable Conpty setting affect it? Also what is the comspec environment variable set to?

Yes, disabling Windows Enable Conpty works, the terminal launches in VS Code. Even in the stable build.

Turning of ConPTY worked for me. ๐Ÿ‘
Removing all keybindings didn't help.

To answer your questions...

keybindings

[
  {
    "key": "ctrl+tab",
    "command": "workbench.action.nextEditor"
  },
  {
    "key": "ctrl+shift+tab",
    "command": "workbench.action.previousEditor"
  },
  {
    "key": "alt+f",
    "command": "-gitlens.showCommitSearch",
    "when": "gitlens:enabled"
  },
  {
    "key": "ctrl+tab",
    "command": "-workbench.action.openNextRecentlyUsedEditorInGroup"
  },
  {
    "key": "ctrl+tab",
    "command": "-workbench.action.quickOpenNavigateNextInEditorPicker",
    "when": "inEditorsPicker && inQuickOpen"
  },
  {
    "key": "ctrl+s",
    "command": "workbench.action.files.saveAll"
  },
  {
    "key": "ctrl+k s",
    "command": "-workbench.action.files.saveAll"
  },
  {
    "key": "ctrl+k s",
    "command": "workbench.action.files.save"
  },
  {
    "key": "ctrl+s",
    "command": "-workbench.action.files.save"
  },
  {
    "key": "ctrl+k ctrl+c",
    "command": "workbench.action.toggleCenteredLayout"
  },
  {
    "key": "ctrl+`",
    "command": "workbench.action.terminal.focus"
  },
  {
    "key": "ctrl+shift+x",
    "command": "multiCommand.reRun",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+,",
    "command": "workbench.action.openSettingsJson"
  },
  {
    "key": "ctrl+.",
    "command": "-settings.action.editFocusedSetting",
    "when": "inSettingsSearch"
  },
  {
    "key": "shift+alt+s",
    "command": "python.sortImports"
  }
]

comspec

image

Answer... for now. ๐Ÿ˜€
https://stackoverflow.com/questions/56154957

the solution for mee.
1 - Go to https://code.visualstudio.com/insiders/ and install Version: 1.35.0-insider
2 - Go to File/Preferences/Settings
3 - Search conPTY and disable --> Terminal โ€บ Integrated: Windows Enable Conpty

image

image

@luchoespejo See a few answers before, it already has been pointed out.

@zadjii-msft any ideas? ConPTY is launching an external conhost, turning on winpty works.

... No, I haven't the faintest clue why this isn't working.

Does the integrated terminal window display anything, or is it just blank?

Does the conhost window that appears have a scrollbar?

If the VS Code terminal is displaying something, then maybe the conhost that's getting launched to host conpty is not in headless mode (somehow).

If it's totally blank, then I'd imagine that somehow the conhost doesn't think that it's getting activated in conpty mode. Conhost will think it's in conpty mode as long as it has one of the pipes (in/out/signal), and if it's being activated via the API, it should definitely have at least the signal pipe.

@zadjii-msft looks like the integrated terminal is blank based on https://stackoverflow.com/q/56154957/1156119

Huh. That's kinda what I imagined, though I'm not sure it really helps psychic debug it. I can't get this to repro locally, so I'm not sure how to be able to debug this further. Maybe it has something to do with OS architecture vs VS Code architecture?

@GollyJer do you have WSL installed? If you do, could you try running cmd.exe from within a wsl prompt? That should activate another conpty, and hopefully help narrow down where this is originating from.

I haven't repro'd it either, but it has been reported a few times. The code responsible for using conpty is at https://github.com/microsoft/node-pty/blob/master/src/win/conpty.cc if that helps.

@zadjii-msft This is strange. I just reenabled Conpty in vscode settings and integrated terminal is working.

To answer your question... yes. I have WSL enabled and Ubuntu installed. Running cmd in bash activated an inline command prompt.

The major change I've made to my system is uninstalling Docker Desktop and disabling HyperV. I had to use VMWare Workstation which doesn't work in conjunction with HyperV.

I don't have time to turn on HyperV and reinstall Docker Desktop today (to test if it's the culprit) but I can at some point if necessary.

Do other's in this thread have Docker installed?

Ran into this same problem and the conpty workaround that @GollyJer posted worked for me.

I'm on Windows 10 Pro (Build 1903) and running Docker for Windows Desktop.

Version: 1.36.1 (system setup)
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:58:59.274Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT ia32 10.0.18362

@zadjii-msft I've gotten quite a few reports for this, still can't repro myself though and I don't know what I can do or ask to help.

encountered the same problem. besides the method provided above I also found that by unchecking the "use legacy console" option in cmd/powershell it is able to run in vscode integrated console as before (at least for me)

unchecking the "use legacy console" option

Oh my god that's 100% it. Just this week we figured out that if you're using the v1 console, that _also_ affects conpty, and launches the v1 console instead of conpty. We actually just made some changes to the OS this week to force conpty to use the v2 console, so hopefully this will be fixed in Insiders soontm

@zadjii-msft is there a microsoft/terminal issue tracking this?

Reproduced at Windows 10 Enterprise build 18362, VS Code v1.37.1. With ConPTY setting turn on, all tried terminals (PS 1.0, PS 6.0, bash) are run in external window. With turning off the setting, it is immediately fixes the issue.

I encountered this same issue and disabling ConPTY for the integrated terminal fixed it for me (no more external Powershell windows are popping up and it works integrated in VS Code). This only started happening when installed Windows 1903.

@Scorpibear @gorban do not turn conpty off, turn off "use legacy console" in your conhost settings: https://github.com/microsoft/vscode/issues/73790#issuecomment-511342381

@Tyriar What if I have windows 7 enterprise.
I have the same issue.

@StdGit that's using a different system (winpty) that we are no longer improving upon, I'm not sure how you would fix that.

Closing since this is fixed in a future version of Windows 10 https://github.com/microsoft/terminal/issues/1838 and nothing more to action.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biij5698 picture biij5698  ยท  3Comments

vsccarl picture vsccarl  ยท  3Comments

VitorLuizC picture VitorLuizC  ยท  3Comments

mrkiley picture mrkiley  ยท  3Comments

trstringer picture trstringer  ยท  3Comments