On 11/29/2013 03:17 PM, Philippe Nobili wrote:
How could we be sure to retrieve the execution status of command-line
conversion command: *convertdoc[.bat] ?*
Exit status is 0 even upon fatal failure, e.g. due to X11 connexion
problems.
I've re-tested this and I've found that the exit code is 2 when a fatal
error has been reported.
For example, "Convert To PDF" without XEP or FOP gives me:
---
$ convertdoc -p highlight.source 1 \
-p variablelist.as.blocks 1 \
-p insert.link.page.number yes \
-p insert.xref.page.number yes \
-p olink.doctitle yes \
-p insert.olink.pdf.frag 1 \
-p current.docid docbook \
-pu target.database.document ../common/doc_pdf.sitemap \
docb.toPSFile help.xml \
-s pdf -s "|pdf" -u ../../doc/docbook/help.pdf
Making portrait pages on A4 paper (210mmx297mm)
...
convertdoc: *** error: Command execution has failed:
Unknown XSL-FO processor "FOP".
(You probably need to download and install the corresponding add-on
using menu item "Options|Install Add-ons".)
$ echo $?
2
---
Would it be possible to trap these kind of exception and make sure that
exit code 0 is returned only when an output document has been generated ?
Rationale: Need to monitor when errors occur for batch document
generation systems.
The problem is that XXE and hence convertdoc (which is XXE without a
GUI; see
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/convertdoc.html),
cannot detect whether a new output document has been actually generated
by running a process command.
Please remember the amount of error messages reported by FOP during
almost any conversion to PDF. I mean, XXE has no reliable way to make
the difference between a minor conversion error and a fatal conversion
error.
I would suggest to add a workaround for this problem in your shell/.bat
script invoking convertdoc:
1) Remove output file if it exists.
2) Run convertdoc.
3) If new output file has not be created, then consider that convertdoc
has failed.
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support