Douglas W Philips wrote: > I'm trying to script ditac.bat (my script creates a ditaval file on > the fly), but when ditac.bat fails, I still get an %ERRORLEVEL% value of 0. > I went into the ditac.bat file itself and had it 'echo %ERRORLEVEL%' > just after the java command and it prints 0. > The failure I'm trying to catch in this case is the failure to write > the output .docx file because it is already open in Word. > ditac says that this is an ERROR, prints a Java stack dump, but still > reports an %ERRORLEVEL% of 0.
--> The stack trace is printed by XMLmind XSL-FO Converter (fo2docx.bat) which then returns an exit code equal to 2. (We have made this less ``frightening'' in next release.) XMLmind DITA Converter (ditac) is programmed [a] to detect such non-zero exit code and [b] then to exit itself with a code greater than 0. Therefore it should work fine and we currently don't see which bug we could fix here. The problem is that ditac invokes something like: cmd.exe /s /c "fo2docx.bat foo.fo bar.docx" and that *cmd.exe* does not itself exit with the same exit code as "fo2docx.bat foo.fo bar.docx". In the above case, cmd.exe always exits with an exit code equal to 0. Hence your problem. --> Workaround: * Configure ditac to use a custom fo2docx.bat and not the stock fo2docx.bat. Use option -xfc or -foconverter for that. See http://www.xmlmind.com/ditac/_distrib/doc/manual/commandLine.html#commandLine * Add: exit %ERRORLEVEL% (not "exit /b", just "exit") just after: java com.xmlmind.fo.converter.Driver -outputFormat=docx %* in your custom fo2docx.bat. Note that this makes your custom fo2docx.bat unusable in an interactive command prompt because "exit %ERRORLEVEL%" causes the whole cmd.exe, and not just fo2docx.bat, to exit. -- XMLmind DITA Converter Support List [email protected] http://www.xmlmind.com/mailman/listinfo/ditac-support

