Browse Source

Better error message when one command fails

master
Matthieu Moy 7 years ago
parent
commit
9d1a3d10e3
  1. 56
      git-latexdiff

56
git-latexdiff

@ -644,8 +644,14 @@ if test "$flatten" = 1; then
verbose "Attempting to regenerate missing old/$maindir$mainbase.bbl" verbose "Attempting to regenerate missing old/$maindir$mainbase.bbl"
oldPWD=$PWD oldPWD=$PWD
cd old/"$maindir" cd old/"$maindir"
log_cmd pdflatex0.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1
log_cmd pdflatex0.log $LATEX_EXEC $latexopt "$mainbase" || {
compile_error=1
error_msg="command 'pdflatex' (automatically run in old due to --bbl) failed."
}
log_cmd bibtex0.log bibtex "$mainbase" || {
compile_error=1
error_msg="command 'bibtex' (automatically run in old due to --bbl) failed."
}
cd "$oldPWD" cd "$oldPWD"
ignore_errors_maybe ignore_errors_maybe
if [ "$compile_error" = 1 ]; then if [ "$compile_error" = 1 ]; then
@ -656,8 +662,14 @@ if test "$flatten" = 1; then
verbose "Attempting to regenerate missing new/$maindir$mainbase.bbl" verbose "Attempting to regenerate missing new/$maindir$mainbase.bbl"
oldPWD=$PWD oldPWD=$PWD
cd new/"$maindir" cd new/"$maindir"
log_cmd pdflatex0.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd bibtex0.log bibtex "$mainbase" || compile_error=1
log_cmd pdflatex0.log $LATEX_EXEC $latexopt "$mainbase" || {
compile_error=1
error_msg="command 'pdflatex' (automatically run in new due to --bbl) failed."
}
log_cmd bibtex0.log bibtex "$mainbase" || {
compile_error=1
error_msg="command 'bibtex' (automatically run in new due to --bbl) failed."
}
cd "$oldPWD" cd "$oldPWD"
ignore_errors_maybe ignore_errors_maybe
if [ "$compile_error" = 1 ]; then if [ "$compile_error" = 1 ]; then
@ -704,19 +716,40 @@ verbose "Compiling result"
compile_error=0 compile_error=0
cd new/"$maindir" || die "Can't cd to new/$maindir" cd new/"$maindir" || die "Can't cd to new/$maindir"
if test -f Makefile && test "$ignoremake" != 1 ; then if test -f Makefile && test "$ignoremake" != 1 ; then
log_cmd make.log make || compile_error=1
log_cmd make.log make || {
compile_error=1
error_msg="command 'make' failed."
}
elif test "$uselatexmk" = 1; then elif test "$uselatexmk" = 1; then
log_cmd latexmk.log latexmk -f -pdf -silent $latexopt "$mainbase" || compile_error=1
log_cmd latexmk.log latexmk -f -pdf -silent $latexopt "$mainbase" || {
compile_error=1
error_msg="command 'latexmk' failed."
}
else else
log_cmd pdflatex1.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex1.log $LATEX_EXEC $latexopt "$mainbase" || {
compile_error=1
error_msg="command pdflatex (first run) failed."
}
if test "$bibtex" = 1 ; then if test "$bibtex" = 1 ; then
log_cmd bibtex.log bibtex "$mainbase" || compile_error=1
log_cmd bibtex.log bibtex "$mainbase" || {
compile_error=1
error_msg="command 'bibtex' failed."
}
fi fi
if test "$biber" = 1 ; then if test "$biber" = 1 ; then
log_cmd biber.log biber "$mainbase" || compile_error=1
log_cmd biber.log biber "$mainbase" || {
compile_error=1
error_msg="command 'biber' failed."
}
fi fi
log_cmd pdflatex2.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex3.log $LATEX_EXEC $latexopt "$mainbase" || compile_error=1
log_cmd pdflatex2.log $LATEX_EXEC $latexopt "$mainbase" || {
compile_error=1
error_msg="command 'pdflatex' (second run) failed."
}
log_cmd pdflatex3.log $LATEX_EXEC $latexopt "$mainbase" || {
compile_error=1
error_msg="command 'pdflatex' (third run) failed."
}
fi fi
verbose_done verbose_done
@ -743,6 +776,7 @@ if test "$compile_error" = "1" ; then
echo "Error during compilation. Please examine and cleanup if needed:" echo "Error during compilation. Please examine and cleanup if needed:"
echo "Directory: $tmpdir/new/$maindir" echo "Directory: $tmpdir/new/$maindir"
echo " File: $mainbase.tex" echo " File: $mainbase.tex"
echo " Problem: $error_msg"
# Don't clean up to let the user diagnose. # Don't clean up to let the user diagnose.
exit 1 exit 1
fi fi

Loading…
Cancel
Save