There is only one way to find out that the process "did not end as expected." The process exit code is nonzero. Set the return value of main () in your own program. Or the value passed to Environment.Exit () in a managed program. Or the error level in a batch file. It is automatically set to an exception code if the main thread of the process dies.
You will need to find out why one of these programs returns a non-zero exit code.
source
share