Execute Process Chain
public void ExecuteProcessChain(string[] asProcesses, string sInRedirect, string sOutRedirect)
{
Process p1 = new Process();
p1.StartInfo.UseShellExecute = false;
p1.StartInfo.RedirectStandardOutput = true;
p1.StartInfo.FileName = asProcesses[0];
p1.Start();
StreamReader sr = p1.StandardOutput;
string s, xxx = "";
while ((s = sr.ReadLine()) != null)
Console.WriteLine("sdfdsfs");
//xxx += s+"\n";
p1.StartInfo.RedirectStandardInput = true;
p1.StartInfo.RedirectStandardOutput = false;
p1.StartInfo.FileName = asProcesses[1];
p1.Start();
StreamWriter sw = p1.StandardInput;
sw.Write(xxx);
sw.Close();
sr.Close();
}
Estoy intentando ejecutar "calc | calc" pero cuando lo hago, se atasca en la líneawhile ((s = sr.ReadLine()) != null)
y solo después de cerrar la calculadora, el código continúa. Necesito ambas calculadoras para trabajar juntas. ¿Tienes idea de cómo hacer eso?