question

PiotrRybak-7170 avatar image
0 Votes"
PiotrRybak-7170 asked joshbauer-3303 edited

c# redirected stderr asking me to type answer. I am not getting question

I do

     var psi = new ProcessStartInfo
     {
         FileName = "ffmpeg.exe",
         RedirectStandardError = true,
         RedirectStandardOutput = true,
         RedirectStandardInput = true,
         UseShellExecute = false
     };
     var p = Process.Start(psi);
     var reader = p.StandardError;

     while (!reader.EndOfStream) {
         string currentLine = reader.ReadLine();
         File.AppendAllText(fNamestdout, currentLine+"\r\n");
     }

It is getting all lines into file till the last line that awaits for typing into keyboard.
I am not getting the last line with question asking me to type something
so I do not know what answer I should type.

How to get the last line asking me to type something?

Program is blocking at reader.ReadLine(); while awaiting me type answer
but I do not know question.

dotnet-csharp
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PiotrRybak-7170,
Based on your code, I can't reproduce the situation.
In order to understand your problem more accurately, please provide your "ffmpeg.exe" to reproduce the situation.
Best Regards,
Daniel Zhang

0 Votes 0 ·
     var psi = new ProcessStartInfo
     {
         FileName = "cmd.exe",
         RedirectStandardError = false,
         RedirectStandardOutput = false,
         RedirectStandardInput = false,
         UseShellExecute = false
     };
     var p = Process.Start(psi);

I do like above to see command DOS.
But when I write RedirectStandardInput = true.

I am not getting anything on screen. Where is command prompt asking me to type something?
How to read it?

0 Votes 0 ·

Hi @joshbauer-3303,
By redirecting the StandardInput stream, you can programmatically specify the input of a process.
Please refer to the code example in this document.
Best Regards,
Daniel Zhang


0 Votes 0 ·
Show more comments

0 Answers