DISCUSSION: An example of running terminal (either Windows Terminal, or conhost) attached to pseudo console #12104

Open
opened 2026-01-31 03:06:27 +00:00 by claunia · 4 comments
Owner

Originally created by @vvavrychuk on GitHub (Jan 18, 2021).

I would like to feed/consume pseudo console pipes from my application and have some terminal (either Windows Terminal, or conhost) connected to this pseudo console. This is almost like https://github.com/microsoft/terminal/tree/main/samples/ConPTY/EchoCon but a little bit reversed. In EchoCon, application that feeds pseudo console (ping) is running as a separate process and current process is assumed to be run from terminal. But I want current process to feed pseudo console (current process can be run from terminal or not, it should not matter), and some terminal should be run from my application connected to pseudo console in a separate window.

The background is that I am porting application from Linux which uses multiple pseudo-consoles in one process. It is reading and writing to/from them in one thread sequentially. And it spawns multiple xterms connected to those pseudo consoles.

If I create multiple Windows pseudo consoles in one process, how can I spawn multiple terminal applications (conhost.exe?, Windows Terminal) to output content of those pseudo consoles?

Originally created by @vvavrychuk on GitHub (Jan 18, 2021). I would like to feed/consume pseudo console pipes from my application and have some terminal (either Windows Terminal, or conhost) connected to this pseudo console. This is almost like https://github.com/microsoft/terminal/tree/main/samples/ConPTY/EchoCon but a little bit reversed. In EchoCon, application that feeds pseudo console (ping) is running as a separate process and current process is assumed to be run from terminal. But I want current process to feed pseudo console (current process can be run from terminal or not, it should not matter), and some terminal should be run from my application connected to pseudo console in a separate window. The background is that I am porting application from Linux which uses multiple pseudo-consoles in one process. It is reading and writing to/from them in one thread sequentially. And it spawns multiple xterms connected to those pseudo consoles. If I create multiple Windows pseudo consoles in one process, how can I spawn multiple terminal applications (conhost.exe?, Windows Terminal) to output content of those pseudo consoles?
claunia added the Issue-QuestionNeeds-Tag-Fix labels 2026-01-31 03:06:27 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jan 19, 2021):

Okay so it might be helpful to have additional terminology defined here.

  • a "commandline client" application is something like ping, bash, etc. It's a application that emits text output and reads text input.
  • a "terminal" application is something that can be used for displaying the text output by a client app, and can read input from the OS and send it to a client app.

So it sounds like you have a client app that needs to output to multiple terminals all at once, correct? Kinda like a reverse tmux, correct? We can try helping come up with a clever solution, but I want to make sure we understand the scenario fully.

@zadjii-msft commented on GitHub (Jan 19, 2021): Okay so it might be helpful to have additional terminology defined here. * a "commandline **client**" application is something like `ping`, `bash`, etc. It's a application that emits text output and reads text input. * a "**terminal**" application is something that can be used for displaying the text output by a client app, and can read input from the OS and send it to a client app. So it sounds like you have a client app that needs to output to multiple terminals all at once, correct? Kinda like a reverse `tmux`, correct? We can try helping come up with a clever solution, but I want to make sure we understand the scenario fully.
Author
Owner

@ghost commented on GitHub (Jan 23, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jan 23, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@vvavrychuk commented on GitHub (Jan 24, 2021):

@zadjii-msft you are absolutely right!

I have tried to code example here https://github.com/vvavrychuk/multipty-example/blob/master/multipty.c

It opens given number of ptys and launches xterm for each using -S flag. If user types something in xterm, it returns back to main application
Screenshot from 2021-01-25 01-06-16

There should be also a way to type client id and message in main application and it will be sent to corresponding client, but that's not finished in this example.

Also, I should probably use non-buffered IO...

@vvavrychuk commented on GitHub (Jan 24, 2021): @zadjii-msft you are absolutely right! I have tried to code example here https://github.com/vvavrychuk/multipty-example/blob/master/multipty.c It opens given number of ptys and launches xterm for each using -S flag. If user types something in xterm, it returns back to main application ![Screenshot from 2021-01-25 01-06-16](https://user-images.githubusercontent.com/152563/105646888-17fff100-5eab-11eb-8b1a-826ab256bd0e.png) There should be also a way to type client id and message in main application and it will be sent to corresponding client, but that's not finished in this example. Also, I should probably use non-buffered IO...
Author
Owner

@DHowett commented on GitHub (Jan 28, 2021):

I'm going to take triage off this, but keep it open as a discussion question. 😄 Thanks!

@DHowett commented on GitHub (Jan 28, 2021): I'm going to take triage off this, but keep it open as a discussion question. :smile: Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12104