logo separator

[mkgmap-dev] Mkgmap always returns exit code 0 even when it fails

From paco.tyson at free.fr paco.tyson at free.fr on Mon Jan 13 20:21:03 GMT 2014

Selon Gerd Petermann <gpetermann_muenchen at hotmail.com>:

> Hi Paco,
>
> I agree, but I found no simple way to change mkgmap.
> I assume that you consider a non empty stderr file as
> an error,

No, Ant checks for the return code : I invoke the java task with the failonerror
attribute (http://ant.apache.org/manual/Tasks/java.html#failonerror) which
explicitly mentions the result code. The result code is set in the Java code
with the System.exit() method.

> so maybe we can check whether anything was
> written to stderr, but sometimes we use this file also for
> important hints like this:
> "WARNING: input files have different code pages"

I agree with you, mkgmap outputs lots of warnings, this workaround would be
tricky at best. It would work if we output information and warnings to stdout
and errors and exceptions to stderr but that requires a check on the complete
codebase.

I ran a grep for System.exit on the codebase and found several calls to
System.exit(), adding a few of them in the right places (e.g. at the end of the
options processing, catching any exception mkgmap can't deal with...) should do
the trick.
Forgive me if I'm wrong here, it's been 10 years since I wrote a single line of
java code.


>
> BTW: Also splitter doesn't make sure that it ends
> with a non-zero return code in case of errors, but
> it tries to do so.

As far as I remember, I've run into incorrect options or missing file errors,
splitter always behaved as expected.

>
> Gerd
>
> > Date: Sat, 11 Jan 2014 00:22:54 +0100
> > From: paco.tyson at free.fr
> > To: mkgmap-dev at lists.mkgmap.org.uk
> > Subject: [mkgmap-dev] Mkgmap always returns exit code 0 even when it fails
> >
> > Hi,
> >
> > I'm building a map generation tool with Ant. Problem is that if mkgmap
> > encounters an error, the exit code is 0, no matter what. As this is the
> "OK"
> > exit code, Ant carries on to the rest of the workflow.
> > On the contrary, splitter does return a non zero code when it fails.
> >
> > Please make mkgmap return a non zero exit code for errors.
> >
> >
> > Thanks,
> > Paco
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev at lists.mkgmap.org.uk
> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>




More information about the mkgmap-dev mailing list