How do I close ConPty Std Input? #14929

Open
opened 2026-01-31 04:23:32 +00:00 by claunia · 0 comments
Owner

Originally created by @gerardog on GitHub (Aug 22, 2021).

Hi. First of all, thanks for all the great work being done!

If I open console app with its input redirected in a classic console, when the input ends the console app can act accordingly:

For example:


:: Create command
C:\Users\gerar>Echo Prompt [TEST] $P$g > MyCommand
C:\Users\gerar>Echo cd .. >> MyCommand

:: Execute with redirected input
C:\Users\gerar>cmd < MyCommand

Microsoft Windows [Version 10.0.19043.1165]
(c) Microsoft Corporation. All rights reserved.

C:\Users\gerar>Prompt [TEST] $P$g

[TEST] C:\Users\gerar> cd ..
[TEST] C:\Users>

:: Child CMD detects End of Input and terminates automatically. 
C:\Users\gerar> 

I am trying to replicate this using ConPty with no luck. If I create a pseudoconsole, send the input but then try closing the input stream (hInput) to signal end-of-input, with different approaches, but none of them seems to work. The client console app keeps waiting for more input.

How can I signal the console app running in a pseudoconsole that the input has ended?

Thanks!

Originally created by @gerardog on GitHub (Aug 22, 2021). Hi. First of all, thanks for all the great work being done! If I open console app with its input redirected in a classic console, when the input ends the console app can act accordingly: For example: ``` cmd :: Create command C:\Users\gerar>Echo Prompt [TEST] $P$g > MyCommand C:\Users\gerar>Echo cd .. >> MyCommand :: Execute with redirected input C:\Users\gerar>cmd < MyCommand Microsoft Windows [Version 10.0.19043.1165] (c) Microsoft Corporation. All rights reserved. C:\Users\gerar>Prompt [TEST] $P$g [TEST] C:\Users\gerar> cd .. [TEST] C:\Users> :: Child CMD detects End of Input and terminates automatically. C:\Users\gerar> ``` I am trying to replicate this using ConPty with no luck. If I create a pseudoconsole, send the input but then try closing the input stream (hInput) to signal end-of-input, with different approaches, but none of them seems to work. The client console app keeps waiting for more input. How can I signal the console app running in a pseudoconsole that the input has ended? Thanks!
claunia added the Needs-TriageNeeds-Tag-FixProduct-Conpty labels 2026-01-31 04:23:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14929