title: Read prompt from Process StandardOut when requiring input
body: <p>I am using System.Diagnostics.Process to create a new process and communicate with the operating system to run a command.</p>
  
  <p>The command will at times require a username, password, both, nothing.</p>
  
  <p>If I read from StandardOutput it will immediately exit.  If I just blindly provide a password\n when I know it requires a password in a test scenario, it works, authenticates with third party, and I can read from StandardOutput to get the results.</p>
  
  <p>As a test I tried this:</p>
  
  <pre><code>            while (_process.StandardOutput.Peek() &gt; -1)
              Log.Info((char)_process.StandardOutput.Read());
  </code></pre>
  
  <p>This will cause the command to immediate exit with a failed to complete exit code.  I tried all sorts of ways of doing it, but I can't figure out a way to figure out if it requires a username or password or has them already (in which it just outputs the result set).</p>
  
  <p>I need to do (pseudo code)</p>
  
  <pre><code>shellCommand(args)
  ReadOutput()
  if (requiresUsername)
     supplyUsernmame
  if (requiresPassword)
     supplyPassword
  OutputResults()
  </code></pre>
  
  <p>I know the command will show Username or Password for the first word if it requires either and then wait for me to supply it.</p>