From 76374bc489611d8ca12a7277ca796366b9f040df Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 29 Sep 2021 21:33:46 -0400 Subject: [PATCH] LibreOffice: Close stdin right away This should prevent LibreOffice from hanging if it attempts to read from stdin (it'll get EOF and probably exit with an error instead). --- src/node/utils/LibreOffice.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/utils/LibreOffice.js b/src/node/utils/LibreOffice.js index 276bc3003..e6e9c0522 100644 --- a/src/node/utils/LibreOffice.js +++ b/src/node/utils/LibreOffice.js @@ -44,10 +44,11 @@ const doConvertTask = async (task) => { '--outdir', tmpDir, ]); + soffice.stdin.end(); // Soffice/libreoffice is buggy and often hangs. // To remedy this we kill the spawned process after a while. + // TODO: Use the timeout option once support for Node.js < v15.13.0 is dropped. const hangTimeout = setTimeout(() => { - soffice.stdin.pause(); // required to kill hanging threads soffice.kill(); }, 120000); let stdoutBuffer = '';