Monday, July 30, 2012 9:52 AM
I am initializing a Process object as shown below. As you can see I am calling to CancelOutputRead as soon as the process finishes its work. But I am not sure by this time the standard output and error have been logged or not. Is there any means to know this before cancelling the asynchronous reading of the output.
Process m_cvsProcess=new Process();
m_cvsProcess.StartInfo.UseShellExecute = false;
m_cvsProcess.StartInfo.RedirectStandardOutput = true;
m_cvsProcess.StartInfo.RedirectStandardError = true;
m_cvsProcess.EnableRaisingEvents = true;
m_cvsProcess.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
m_cvsProcess.ErrorDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
m_cvsProcess.Exited += new EventHandler(cvsProcess_Exited);
while (!exited )
exited = executorProcess.WaitForExit(60000);
void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
AddLog(e.Data); // write output to RichTextBox
Monday, July 30, 2012 12:39 PM
??? exited is a bool. You're not compiling this code.
Monday, July 30, 2012 4:15 PMI have m_cvsProcess.CancelOutputRead(); in my code. That was a type mistake.
Tuesday, July 31, 2012 12:57 PMModerator
Welcome to the MSDN Forum.
You can know it in process_OutputDataReceived function. When data is received, this function will be run. And you can check the log is been logged successfully or not in the AddLog function. You can feedback the status in the AddLog function.
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Thursday, August 09, 2012 3:12 PM