I was planning to invoke validate in a script, and check to see if my plan validated using the customary check against exit status. But I was disappointed to find that even when validate emitted `Bad plan description!" its exit code was still zero.
Digging further, since the plan argument is optional, and it's possible to check multiple plans in a single run of validate, I can see why the exit code wasn't set. And, indeed, AFAICT if validate fails to parse a plan file, it gets a zero back from getPlan, which means it's just like the plan not being there.
But if validate doesn't set an exit code, how can one use it in a script?
I was planning to invoke
validatein a script, and check to see if my plan validated using the customary check against exit status. But I was disappointed to find that even whenvalidateemitted `Bad plan description!" its exit code was still zero.Digging further, since the plan argument is optional, and it's possible to check multiple plans in a single run of validate, I can see why the exit code wasn't set. And, indeed, AFAICT if
validatefails to parse a plan file, it gets a zero back fromgetPlan, which means it's just like the plan not being there.But if
validatedoesn't set an exit code, how can one use it in a script?