Skip to content

Commit 24c1c63

Browse files
committed
Return actual error code from FOP failure in PDF build
Previously we returned "1" on error. Improvement on 77c189c. Backpatch-through: master
1 parent dfbb092 commit 24c1c63

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/src/sgml/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,13 @@ XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
155155
%-US.fo: stylesheet-fo.xsl %-full.xml
156156
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $^
157157

158+
# There is no easy way to pipe output and capture its return code,
159+
# so add a final line to report the return code.
158160
%.pdf: %.fo $(ALL_IMAGES)
159-
@# There is no easy way to pipe output and capture its return code, so output a special string on failure.
160-
{ LANG=C $(FOP) -fo $< -pdf $@ 2>&1; [ "$$?" -ne 0 ] && echo "FOP_ERROR"; } | \
161-
$(AWK) 'BEGIN { warn = 0 } ! /^FOP_ERROR$$/ { print } /not available in font/ { warn = 1 } \
161+
{ LANG=C $(FOP) -fo $< -pdf $@ 2>&1; echo "FOP_RETURN $$?"; } | \
162+
$(AWK) 'BEGIN { warn = 0 } $$1 != "FOP_RETURN" { print } /not available in font/ { warn = 1 } \
162163
END { if (warn != 0) print("\nFound characters that cannot be output in the PDF document; see README.non-ASCII"); \
163-
if ($$0 ~ /^FOP_ERROR$$/) { exit 1} }' 1>&2
164+
if ($$2 != 0) { exit $$2} }' 1>&2
164165

165166

166167
##

0 commit comments

Comments
 (0)