refs #4550 Bugs solved
gitea/printnatura/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2022-12-19 14:36:51 +01:00
parent 06792727ef
commit 9bda14b401
1 changed files with 2 additions and 3 deletions

View File

@ -172,14 +172,13 @@ class PrintServer {
fs.mkdirSync(tmpPath)
const tmpFilePath = path.join(tmpPath, `${Math.random().toString(36).substring(7)}.pdf`);
await fs.writeFile(tmpFilePath, pdfData, 'binary');
const printCommand = `p -d "${printer}" "${tmpFilePath}"`;
// Print PDF
try {
await pExec(printCommand);
await pExec(`lp -d "${printer}" "${tmpFilePath}"`);
} catch(err) {
await fs.unlink(tmpFilePath);
throw new Error(`Print error: '${printCommand}': ${err.message}`);
throw new Error(`Print error: ${err.message}`);
}
await conn.query(updateQuery, ['printed', null, jobId]);