E
Eran.Yasso
Hi,
My app starts process. Some times this process exits because of
exception. Can my app know if the process exited due to exception or
gracefully?
In both ways, the exit code of this process is zero.
I tried using the following, but it goes to catch.
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo();
try
{
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardError = true;
TestProcess.StartInfo = myProcessStartInfo;
TestProcess = Process.Start( MyProcess , " -file "+
cfrmTRSobj.GetTRSFullFileName() );
SetProcID( TestProcess );
TestProcess.WaitForExit();
StreamReader myStreamReader = TestProcess.StandardError;
MessageBox.Show(myStreamReader.ReadToEnd());
}
catch( Exception e )
{
bRetval = frmMain.RETVALSTATUS.FAIL;
TestStatus = frmMain.DGETestStatusenums.STATUSFAILED;
}
when the app reached to "StreamReader myStreamReader =
TestProcess.StandardError;" it jump to catch.
Is there any other way or am I doing any thing wrong?
My app starts process. Some times this process exits because of
exception. Can my app know if the process exited due to exception or
gracefully?
In both ways, the exit code of this process is zero.
I tried using the following, but it goes to catch.
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo();
try
{
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardError = true;
TestProcess.StartInfo = myProcessStartInfo;
TestProcess = Process.Start( MyProcess , " -file "+
cfrmTRSobj.GetTRSFullFileName() );
SetProcID( TestProcess );
TestProcess.WaitForExit();
StreamReader myStreamReader = TestProcess.StandardError;
MessageBox.Show(myStreamReader.ReadToEnd());
}
catch( Exception e )
{
bRetval = frmMain.RETVALSTATUS.FAIL;
TestStatus = frmMain.DGETestStatusenums.STATUSFAILED;
}
when the app reached to "StreamReader myStreamReader =
TestProcess.StandardError;" it jump to catch.
Is there any other way or am I doing any thing wrong?