Task exit code handling in loop - 7.7.1 - VisualCron - Forum

Community forum

We experienced an issue in VC 7.7.1 today with regards to the result code handling of a task in a loop.

The task had an exit code of 1, but did not cause a failure, even though the configuration shows it should. I searched the forums and could find a reference to what might be related, but I'm not sure if this is indeed a fix. In the release notes for 7.7.5 it mentions [BUGFIX] Server: Variables->Fixed result Variable issue for Tasks in loops

Could someone please confirm whether this fixes our issue?

I've attached some screenshots showing all the configurations which shows it should raise an error.

Thanks in advance!

JobTasks.PNG serverlog.PNG TaskFlow.PNG JobLog.PNG TaskOnError.PNG
I do not think that fix is related - but on the other hand I cannot reproduce this in the latest version.
Please like  VisualCron on facebook!
Thank you Henrik, are you able to reproduce the behaviour on 7.7.1? And does the settings look correct on the screenshots I provided?
Your logic looks fine to me. I have a vague memory of one vc version that had a funny behaviour regarding exit codes. I would try a newer version on your test server.
I assume you have one :)

It can also be useful create a simple test job. So for example a simple test program that looks like this:

static int Main(string[] args)
return Convert.ToInt32(args[0]);

Try with both 0 and 1 as input parameters, and see if it triggers an error. Do not use the event trigger in your test job. If the above script does not trigger a non-zero exit for you (with 1 as intput), there is definitely a bug with the version. I tested it on 8.2.0 and it works as expected there.

I've tested on 8.1.2, and it works as expected, so I'm guessing the bug must have been fixed between 7.7.1 and 8.1.2.

We'll upgrade and retest.

Just some more feedback, I was able to fix the problem on 7.7.1. Below are the steps I used.

• Open any task and click the On Error tab
• Click the gears icon next to the Exit code collection dropdown - Windows (default) selected by default
• Double-click the exit code 1 line
• Change the Result to Success and click OK
• Double click the exit code 1 line again
• Change the Result to Failure and click OK
• Close the Exit Codes screen
• Close the Edit Task screen (no need to save)

My test task exiting with code 1 now reports an error instead of success.

The configuration was set to fail for exit code 1, but it seems somewhere internally there was a disconnect between what was shown and what was actually used.
Scroll to Top