lib/grover/js/processor.cjs in grover-1.1.3 vs lib/grover/js/processor.cjs in grover-1.1.4
- old
+ new
@@ -8,15 +8,22 @@
process.stdout.write("\n");
process.exit(1);
}
process.stdout.write("[\"ok\"]\n");
+const fs = require('fs');
+const os = require('os');
+const path = require('path');
+
const _processPage = (async (convertAction, urlOrHtml, options) => {
- let browser, errors = [];
+ let browser, errors = [], tmpDir;
try {
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'grover-'));
+
const launchParams = {
- args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox', '--disable-setuid-sandbox'] : []
+ args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox', '--disable-setuid-sandbox'] : [],
+ userDataDir: tmpDir
};
// Configure puppeteer debugging options
const debug = options.debug; delete options.debug;
if (typeof debug === 'object' && !!debug) {
@@ -243,9 +250,13 @@
}
} finally {
if (browser) {
await browser.close();
}
+
+ try {
+ if (tmpDir) fs.rmSync(tmpDir, { recursive: true });
+ } catch { }
}
});
function _handleError(error) {
if (error instanceof Error) {