I have below code in sample.ts (typescript) where the exe always returns an exit code of 0 (success), 1 (failure) or 2 (unknown errors). I would expect the validateFunc call to return an exit code properly and land in the next line but instead it goes to the catch block for non-zero exit codes. Any idea what causes that behavior?
try
{
...{some code}
let exitCode = await validateFunc("sample1", "sample2");
if(exitcode!=0)
{
// expecting toland here when tool returns non-zero exit code
}
..{some code here}
}
catch (error)
{
// Above call to validateFunc lands here for non-zero exit codes
}
export async function validateFunc(param1: string, param2: string) {
{some code here}
return await tl.exec(`${validationToolRoot}\\<Exename>`, validationArgs);
}