while(true)
{
var cki = Console.ReadKey(true);
Console.WriteLine(cki.Key);
}
This code works when i run it from cmd/powershell, but doesn't work from git bash. This is the exception:
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
The approach suggested from the exception is to use Console.Read method but it works very different from ReadKey. So how can I run a .net core console app from git bash, press 'down arrow', 'up arrow', or whatever key I press and get info for the key pressed immediately in my application?