oleg-shilo / cs-script

C# scripting platform
http://www.cs-script.net
MIT License
1.57k stars 234 forks source link

cscs does not return error code when "-check" switch used #292

Closed eugene-vv closed 1 year ago

eugene-vv commented 2 years ago

Hi Oleg, I think that in case of error "cscs -check" must return exit code different from 0. Also it will be good to have the error description in stderr instead of stdout. The same way as when I run script for execution without "-check" key. Thanks, Eugene

oleg-shilo commented 2 years ago

Eugene, it is not that simple.

Semantically Exit code is an expression of the success of the process. Did it exit normally or not?

https://en.wikipedia.org/wiki/Exit_status

...other information like how the process exited, either normally or by a signal may also be available to the parent process.

Thus you are asking the script engine "can you check this script please". And the engine successfully performs this operation (exit code 0).

When you try to execute the script with the syntax error the engine cannot do what you asked so it returns 1.

In both cases the context info goes to the output that is consistent with the exit code StdOut vs ErrOut