J'ai la méthode:Pourquoi cette méthode redirige-t-elle ma sortie de .exe [ffmpeg]?
public static string StartProcess(string exePathArg, string argumentsArg, int timeToWaitForProcessToExit)
{
string retMessage = "";
using (Process p = new Process())
{
p.StartInfo.FileName = exePathArg;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.Arguments = argumentsArg;
p.StartInfo.UseShellExecute = false;
try
{
p.Start();
StreamReader myOutput = p.StandardOutput;
retMessage = "STANDARD OUTPUT: " + myOutput.ReadToEnd();
p.WaitForExit(timeToWaitForProcessToExit);
}
catch (Exception ex)
{
retMessage = "EXCEPTION THROWN: " + ex.ToString();
}
finally
{
try
{
p.Kill();
}
catch { }
}
}
return retMessage;
}
Mais il ne marche pas redirigent ma sortie retMessage. Quelqu'un a des idées? J'ai testé les arguments dans un fichier bat et la sortie est définitivement sortie.
Cheers, Pete
Peut-être que le processus n'écrit pas à StandardOutput mais uniquement à StandardError? – dtb