Reputation: 190659
This post has the following code.
Process p = new Process();
StringBuilder sb = new StringBuilder("/COVERAGE ");
sb.Append(exeFileName);
p.StartInfo.FileName = "vsinstr.exe";
p.StartInfo.Arguments = sb.ToString();
p.Start();
p.WaitForExit();
// Look at return code – 0 for success
The comment says I need to check the return code, but p.WaitForExit()
doesn't return anything.
Upvotes: 1
Views: 4274
Reputation: 6911
Just check
p.ExitCode
after process exits. Process.ExitCode Property
Upvotes: 0
Reputation: 74177
After the process completes, the property ExitCode
of the System.Diagnostics.Process object instance should contain the program status code.
Upvotes: 0
Reputation: 74802
For Q1, check the Process.ExitCode
property.
For Q2, exit codes for success and failure are defined by the called process itself, but conventionally 0 indicates success and anything else indicates failure.
Upvotes: 6
Reputation: 15621
just look at the ExitCode property to see if the process exited happily or not.
With respect to a running process, you can watch the standard error stream to see if any messages are printed there. Chances are they will represent some kind of problem, but this is even more implementation-dependant than the exit code.
Upvotes: 2