gablilli commited on
Commit ·
d35219a
1
Parent(s): c355fc6
fix: vercel tweak
Browse files- api/download.js +3 -1
- providers/dibooklaterza.js +2 -1
api/download.js
CHANGED
|
@@ -48,6 +48,7 @@ export default function handler(req, res) {
|
|
| 48 |
let outputFile = null;
|
| 49 |
let stderrBuf = "";
|
| 50 |
let stdoutBuf = "";
|
|
|
|
| 51 |
|
| 52 |
const proc = spawn("node", args, {
|
| 53 |
cwd: PROJECT_ROOT,
|
|
@@ -60,6 +61,7 @@ export default function handler(req, res) {
|
|
| 60 |
|
| 61 |
proc.stdout.on("data", (chunk) => {
|
| 62 |
const text = chunk.toString();
|
|
|
|
| 63 |
stdoutBuf += text;
|
| 64 |
|
| 65 |
// Parse per-line to handle multiple messages in one chunk.
|
|
@@ -96,7 +98,7 @@ export default function handler(req, res) {
|
|
| 96 |
|
| 97 |
if (code !== 0 || !outputFile) {
|
| 98 |
cleanup(outputDir);
|
| 99 |
-
const msg = (stderrBuf.trim() || stdoutBuf.trim()) || `Il provider è terminato con codice ${code}`;
|
| 100 |
res.status(500).json({ error: msg });
|
| 101 |
return;
|
| 102 |
}
|
|
|
|
| 48 |
let outputFile = null;
|
| 49 |
let stderrBuf = "";
|
| 50 |
let stdoutBuf = "";
|
| 51 |
+
let stdoutAll = "";
|
| 52 |
|
| 53 |
const proc = spawn("node", args, {
|
| 54 |
cwd: PROJECT_ROOT,
|
|
|
|
| 61 |
|
| 62 |
proc.stdout.on("data", (chunk) => {
|
| 63 |
const text = chunk.toString();
|
| 64 |
+
stdoutAll += text;
|
| 65 |
stdoutBuf += text;
|
| 66 |
|
| 67 |
// Parse per-line to handle multiple messages in one chunk.
|
|
|
|
| 98 |
|
| 99 |
if (code !== 0 || !outputFile) {
|
| 100 |
cleanup(outputDir);
|
| 101 |
+
const msg = (stderrBuf.trim() || stdoutAll.trim() || stdoutBuf.trim()) || `Il provider è terminato con codice ${code}`;
|
| 102 |
res.status(500).json({ error: msg });
|
| 103 |
return;
|
| 104 |
}
|
providers/dibooklaterza.js
CHANGED
|
@@ -89,7 +89,8 @@ export async function run(options = {}) {
|
|
| 89 |
|
| 90 |
(async () => {
|
| 91 |
if (!argv.useSystemExecutable && !fs.existsSync(argv.pdftkJava)) {
|
| 92 |
-
console.
|
|
|
|
| 93 |
return;
|
| 94 |
}
|
| 95 |
|
|
|
|
| 89 |
|
| 90 |
(async () => {
|
| 91 |
if (!argv.useSystemExecutable && !fs.existsSync(argv.pdftkJava)) {
|
| 92 |
+
console.error('pdftk-all.jar non trovato.\nAssicurati che il file esista in ./pdftk-all.jar oppure usa --useSystemExecutable con pdftk installato nel sistema.');
|
| 93 |
+
process.exitCode = 1;
|
| 94 |
return;
|
| 95 |
}
|
| 96 |
|