views:

353

answers:

1

If in my C# application, I am creating a child process that can either terminate normally, or start misbehaving, in which case I terminate it with a call to Process.Kill().However, I would like to know if the process has exited normally.I know I can get the error code of a terminated process, but what would be a normal exit code and what would signify that the process was killed?

+1  A: 

You can use the property ExitCode but unfortunately this depends on how the app is built. So if you have the source code for the app make sure that it returns correctly upon a good exit. Please see this link to msdn describing this more in detail: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.exitcode.aspx

Oskar Kjellin