ConHost process remains with ping -t in EchoCon #403

Open
opened 2026-01-30 21:51:02 +00:00 by claunia · 0 comments
Owner

Originally created by @Biswa96 on GitHub (Oct 8, 2018).

  • Windows build number: 10.0.18247.1001

  • What I did: Open the EchoCon.cpp file > Edit the command string as ping -t localhost and set INFINITE time in WaitForSingleObject() > Compile it > Run EchoCon.exe > Press Ctrl+C after some pings > See task manger ASAP! Two process remains one ConHost.exe and another Ping.exe. These two processes are killed automatically after some seconds.

  • Question: Is this an expected behavior? Isn't the child process terminated automatically with the parent process?

  • Bonus question: The blog shows demo with WriteFile(hIn,..) & EchoCon has WriteFile(hOut,...). How can I mix them? For example, the child process will be only cmd.exe without any other parameter.

Originally created by @Biswa96 on GitHub (Oct 8, 2018). * Windows build number: 10.0.18247.1001 * What I did: Open the EchoCon.cpp file > Edit the command string as `ping -t localhost` and set `INFINITE` time in `WaitForSingleObject()` > Compile it > Run EchoCon.exe > Press Ctrl+C after some pings > See task manger ASAP! Two process remains one `ConHost.exe` and another `Ping.exe`. These two processes are killed automatically after some seconds. * Question: Is this an _expected behavior_? Isn't the child process terminated automatically with the parent process? * Bonus question: The blog shows demo with `WriteFile(hIn,..)` & EchoCon has `WriteFile(hOut,...)`. How can I mix them? For example, the child process will be only `cmd.exe` without any other parameter.
claunia added the Issue-QuestionProduct-Conpty labels 2026-01-30 21:51:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#403