Why require Sys.exit(0)?
It seems that if I don't do a Sys.exit(0) in my action then it re-runs the dispatch, and will often then complain about a "arguments not supplied" error etc. Is this a deliberate design decision or an oversight?
The case I want to support is:
public function doThingA() { Sys.exit(0); }
public function doThingB() { Sys.exit(0); }
public function doTwoThings() { doThingA(); doThingB(); Sys.exit(0); }
I can work around it easily enough using private functions that do the actual work, but if it's just an oversight and not a deliberate decision I'll fix it instead :)
Hello! Sorry for taking so long to answer
I cannot reproduce the need of Sys.exit. Can you elaborate on when it's needed? Thanks!
I finally came across it again and figured it out.
It was a misunderstanding on my part, I had this:
public function runDefault()
{
Sys.println(this.showUsage());
}
I thought runDefault happened only when no other task is called, but it seems it runs every time, unless "preventDefault()" is called, (or, am I right, if one of the parameters of runDefault is not optional?)
Either way this behaviour is different to haxe.web.Dispatch(). I can live with the behaviour, but it would be nice to document it in the README.
I guess that it's indeed strange that runDefault will always execute except when it has arguments. I'll look into it.