From ded0ab482a98ec8e444a98cd1618aa7cd6a38af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=9C?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=8F?= Date: Wed, 3 Apr 2019 17:46:45 +0400 Subject: [PATCH] add nonstopmode --- .../java/ru/ulstu/paper/service/LatexService.java | 12 +++++------- src/main/resources/templates/papers/paper.html | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/ru/ulstu/paper/service/LatexService.java b/src/main/java/ru/ulstu/paper/service/LatexService.java index a44a649..a130fc5 100644 --- a/src/main/java/ru/ulstu/paper/service/LatexService.java +++ b/src/main/java/ru/ulstu/paper/service/LatexService.java @@ -40,12 +40,9 @@ public class LatexService { Process process = processBuilder.start(); InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); - BufferedReader bufferedReader = new BufferedReader(inputStreamReader); - try { + try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { while ((bufferedReader.readLine()) != null) ; - } finally { - bufferedReader.close(); } int exitCode = process.waitFor(); @@ -56,9 +53,10 @@ public class LatexService { } private boolean generate(String filename, File dir) throws IOException, InterruptedException { - if (startProcess(new String[]{"pdflatex", filename}, dir, pdfLatexError) != 0) return false; - startProcess(new String[]{"bibtex", filename}, dir, bibtexError); - if (startProcess(new String[]{"pdflatex", filename}, dir, pdfLatexError) != 0) return false; + startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError); + startProcess(new String[]{"bibtex", filename, "--interaction=nonstopmode"}, dir, bibtexError); + if (startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError) != 0) + return false; return checkPdf(filename, dir); } diff --git a/src/main/resources/templates/papers/paper.html b/src/main/resources/templates/papers/paper.html index 2d89936..0ba628e 100644 --- a/src/main/resources/templates/papers/paper.html +++ b/src/main/resources/templates/papers/paper.html @@ -339,7 +339,6 @@ function generatePDF() { $('#pdfLoadingIcon').show(); $('#pdfBtn').prop('disabled', true); - ; var formData = new FormData(document.forms.paperform); var xhr = new XMLHttpRequest(); @@ -360,10 +359,10 @@ a.click(); window.URL.revokeObjectURL(url); } else { + showFeedbackMessage("Ошибка при создании PDF"); } $('#pdfLoadingIcon').hide(); $('#pdfBtn').prop('disabled', false); - ; } }