I call cscs.exe to run some C# scripts in a Windows batch file ("cscs.exe <scriptname>"), and I noticed that although my C# script is correctly setting its exit code, that code is not being propagated out to the calling batch file, so the batch file doesn't know if my C# script succeeded or failed.
I checked out the latest cscs source (hash af846e865e5016138d233fcb6d5bc16da18305a3) and it looks like the problem is that the RunConsoleApp function in cscscript\CSExecutionClient.cs never checks the exit code of the process. I was able to fix this with a simple one-line addition just before the function exits:
```
Environment.ExitCode = process.ExitCode;
```
Was this an oversight, or is this intended behavior? My naive expectation was that using "cscs.exe <scriptname>" would be nearly identical to compiling the script and then calling the compiled executable.
Comments: Minor typo in my last comment, that code should not have a quote at the end: ``` //css_host /platform:x86 ```
I checked out the latest cscs source (hash af846e865e5016138d233fcb6d5bc16da18305a3) and it looks like the problem is that the RunConsoleApp function in cscscript\CSExecutionClient.cs never checks the exit code of the process. I was able to fix this with a simple one-line addition just before the function exits:
```
Environment.ExitCode = process.ExitCode;
```
Was this an oversight, or is this intended behavior? My naive expectation was that using "cscs.exe <scriptname>" would be nearly identical to compiling the script and then calling the compiled executable.
Comments: Minor typo in my last comment, that code should not have a quote at the end: ``` //css_host /platform:x86 ```