I'm working on a simple console application and I'm attempting to read an user input during process WaitForExit().
var process = Process.GetCurrentProcess();
while (process.WaitForExit(6000)) arg1 = Console.ReadLine();
arg1 is defined as an empty string. The problem is that my WaitForExit executes but anything inside the loop does not, so the program waits for 6 seconds and proceeds without asking for input.
I also tried something like:
process.WaitForExit(6000);
while (!process.hasExited) arg1 = Console.ReadLine();
Is there anyway to do this by using WaitForExit() ?