AnantLabs / nconsoler

Automatically exported from code.google.com/p/nconsoler
0 stars 0 forks source link

running console program built with nconsoler does not use a proper exit code if there are any validation errors #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build the HelloWorld Example
2. run HelloWorld.exe

What is the expected output? What do you see instead?

I would have expected HelloWorld.exe to exit with error code 1 because of
validation errors.

HelloWorld.exe exited with error code 0

What version of the product are you using? On what operating system?

NConsoler 1.0
Windows XP Pro x64 SP2

Please provide any additional information below.

This is also related to the scenario where the console program is run with
a valid "Action" but without all the required parameters.  The process will
still return an exit code of 0, instead of the expected 1.

Thank you.

Original issue reported on code.google.com by rami.abughazaleh@gmail.com on 1 Nov 2009 at 6:50

GoogleCodeExporter commented 9 years ago
Hi, I added exit error code for NConsoler specific errors - 
currently it sets 1 as error code 

const int errorExitCode = 1;
Environment.ExitCode = errorExitCode;

Tested for method:

[Action]
public static void M1(string a1, string a2)
{
    Console.WriteLine(a1);
}

And tested with script:

program.exe 1stArg
echo on
echo %errorlevel%
pause

it outputs something like:
Not all required parameters are set
1

Original comment by tihobra...@gmail.com on 6 Nov 2009 at 11:38

GoogleCodeExporter commented 9 years ago
This code available in SVN

Original comment by tihobra...@gmail.com on 6 Nov 2009 at 11:39