-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console.ReadKey throws in unexpected circumstances #59059
Comments
Tagging subscribers to this area: @dotnet/area-system-console Issue DetailsDescriptionit appears that an exited application hangs on to console handles after it exits here's the code that shows off the issue. using System;
using System.Diagnostics;
class Sample
{
public static void Main()
{
Console.CancelKeyPress += new ConsoleCancelEventHandler(handler);
ProcessStartInfo psi = new ProcessStartInfo("/usr/local/bin/iex");
//psi.RedirectStandardInput = true;
do
{
using(var p = Process.Start(psi)) {
p?.WaitForExit();
}
Console.WriteLine("\nproc has ended.\npress a key to run it again - 'q' to stop");
}
while (Console.ReadKey(true).KeyChar != 'q');
}
protected static void handler(object? sender, ConsoleCancelEventArgs args)
{
args.Cancel = true;
}
} run the program and press
Configuration
Regression?not sure Other informationif the line which redirects StandardInput (or StandardOutput) is not commented out the error does not occur. i'm confused as to what's going on, the process has exited, but the error suggests that something is hanging on to a console handle.
|
Related to PowerShell/PowerShell#11215 |
Not a regression, it reproes in 3.1 and 5.0, but definitely we need to take a look. |
Description
it appears that an exited application hangs on to console handles after it exits
The application that I'm seeing in is the
erlang
programiex
.here's the code that shows off the issue.
run the program and press
CTRL-C
twice (timing doesn't seem to matter here - quickly or slowly doesn't affect the outcome).Configuration
Regression?
not sure
Other information
if the line which redirects StandardInput (or StandardOutput) is not commented out the error does not occur. i'm confused as to what's going on, the process has exited, but the error suggests that something is hanging on to a console handle.
The text was updated successfully, but these errors were encountered: