Read Input from Process.StandardOutput when getting prompted for information.

I am using System.Diagnostics.Process and redirecting StandardOutput, StandardError, and StandardInput using the event callbacks.

Whenever I call a process that requests user input (username or password for example) the process will bug out.

If I know what it will do (which is fine when testing, but in the field is impossible) I can supply that information via StandardInput and it works fine. Then it will output the results via StandardOutput.

The problem is I don't see the prompts ("Enter Username" or "Enter Password") via StandardOuput when running the process, so I don't know if it is waiting for a username, password, or just completed fine.

Is there some reason why the prompt won't show up via my StandardOutput event handlers, but the status comes through fine? I need some way of finding out if it is asking for username, password, or nothing).

by Saxi via /r/csharp

Leave a Reply