Killing guest process after query finishes
I am aware of the "Always Preserve Query Process" and "Always use Fresh Process per Execution" settings. But how can I ensure that the process is terminated without manual intervention (Query > Kill process) once the query finishes? I don't need a setting; if I can add a last statement to my code, that's also fine with me.
Comments
-
There are two ways to do this. The first is with the following code:
Util.NewProcess = true;
This tells LINQPad to use a fresh process next time the script runs, similar to the setting "Always use Fresh Process per Execution".
The second (which is I think what you want) is to execute the following:
Environment.Exit (0);
This immediately ends the script - LINQPad will show "Script ended with exit code 0" in the status bar.