ConPTY Passthrough mode #2785

Closed
opened 2026-01-30 23:05:03 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Jul 16, 2019).

I've discussed this a couple times on different threads before, but I think I never made a real issue for it.

The idea of conpty passthrough mode is that a commandline client application that knows it's only going to use VT sequences (and not the API) to modify the console could set a special mode, ENABLE_PASSTHROUGH_MODE. If conpty is active, the console would then stop rendering itself over conpty, and anything that was written to the console would go straight to the terminal.

  • This would work especially well for something like wsl, where it's only ever going to be talking VT.
  • It would not work for cmd.exe, because of cmd.exe's heavy reliance on the API.
  • Windows Powershell again needs the API pretty heavily, but maybe Powershell Core, which is cross-platform, could make use of it.

This has some rough edges that need to be sorted out.

  • What happens when the app exits, and passthrough mode is turned off? The terminal and conpty's buffers would not be equivalent anymore!
    • I've been toying with the idea of having conpty both pass the sequences through, and also process them itself, so that the terminal and conpty stay in sync.
  • What happens when someone tries to call Console API's in passthrough mode?
    • I'm thinking we just cause them to fail. All save for Get/SetConsoleMode and reading input / writing output.
    • We'll also probably need to be able to read resize events.

This needs a real spec written, but it probably needs prototyping done before that.

Originally created by @zadjii-msft on GitHub (Jul 16, 2019). I've discussed this a couple times on different threads before, but I think I never made a real issue for it. The idea of conpty passthrough mode is that a commandline client application that _knows_ it's only going to use VT sequences (and __not__ the API) to modify the console could set a special mode, `ENABLE_PASSTHROUGH_MODE`. If conpty is active, the console would then _stop_ rendering itself over conpty, and anything that was written to the console would go straight to the terminal. * This would work especially well for something like `wsl`, where it's only ever going to be talking VT. * It would _not_ work for cmd.exe, because of cmd.exe's heavy reliance on the API. * Windows Powershell again needs the API pretty heavily, but maybe Powershell Core, which is cross-platform, could make use of it. This has some rough edges that need to be sorted out. * [ ] What happens when the app exits, and passthrough mode is turned off? The terminal and conpty's buffers would not be equivalent anymore! - I've been toying with the idea of having conpty both pass the sequences through, and also process them itself, so that the terminal and conpty stay in sync. * [ ] What happens when someone tries to call Console API's in passthrough mode? - I'm thinking we just cause them to fail. All save for `Get/SetConsoleMode` and reading input / writing output. - We'll also probably need to be able to read resize events. This needs a real spec written, but it probably needs prototyping done before that.
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 16, 2019):

This may actually be #1173?

@DHowett-MSFT commented on GitHub (Jul 16, 2019): This may actually be #1173?
Author
Owner

@zadjii-msft commented on GitHub (Jul 16, 2019):

oh my god I've filed a dupe, you can go ahead and draw and quarter me now

@zadjii-msft commented on GitHub (Jul 16, 2019): _oh my god I've filed a dupe, you can go ahead and draw and quarter me now_
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 16, 2019):

mfw "draw and quarter me now": 🤔😱

@DHowett-MSFT commented on GitHub (Jul 16, 2019): mfw "draw and quarter me now": 🤔😱
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2785