Quantcast
Channel: CS-Script Source
Viewing all articles
Browse latest Browse all 355

Commented Unassigned: cscs.exe does not set exit code [2]

$
0
0
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 ```

Viewing all articles
Browse latest Browse all 355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>