Can I catch APPCRASH of command line app launched with C#'s System.Diagnostic.Process()? -
i need write c# application calling command line tool (probably written in c), of know it's unstable. wonder if it's possible catch random crashes of tool in application.
it enough handle these crashes terminating app , writing log message indicating tool has crashed.
this how call (details process.startinfo settings omitted):
process exeprocess = new process(); exeprocess.start(); exeprocess.waitforexit(); exeprocess.close();
i can reproduce 1 particular kind of crash due bad input data (c0000005 access violation exception), check preconditions before starting process. i'm sure in production other kinds of crashes occur.
there's not whole lot predictable process crashes violently. if due hardware exception, accessviolation, there reasonable odds process exit code indicator. use process.exitcode after waitforexit() read it. value of 0 indicates success, although that's app well.
Comments
Post a Comment