Is there a way to tell when Process is waiting input?

I am using a program that uses c# to integrate with the operating system through Process. It runs a process that connects to a third party via username/password.

When the username/password is incorrect, it will prompt for username/password on the command prompt.

I am trying to find a way to detect that it is awaiting input and Close() the process and alert the program "bad username/password".

If I try to read from Process.StandardOutput when it is waiting for input, it crashes the application. I'm not sure if this is a bug in the application, or is that would be expected. But I also need a way to close the process if it is waiting for input (as it isn't interactive, I want to just let the user know the password is invalid, and to update settings).

by Saxi via /r/csharp

Leave a Reply