Skip to content

Commit

Permalink
feat(api:node): add option to disable GPU with puppeteer (speced#4606)
Browse files Browse the repository at this point in the history
  • Loading branch information
deniak committed Dec 19, 2023
1 parent c3113aa commit 365bf67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/respecDocWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const noop = () => {};
* @param {(warning: RsError) => void} [options.onWarning] What to do if a ReSpec processing has a warning. Does nothing by default.
* @param {(msg: string, timeRemaining: number) => void} [options.onProgress]
* @param {boolean} [options.disableSandbox] See https://peter.sh/experiments/chromium-command-line-switches/#no-sandbox
* @param {boolean} [options.disableGPU] See https://developer.chrome.com/blog/headless-chrome/#starting_headless_cli
* @param {boolean} [options.devtools] Show the Chromium window with devtools open for debugging.
* @return {Promise<{ html: string, errors: RsError[], warnings: RsError[] }>}
* @throws {Error} If failed to process.
Expand All @@ -28,6 +29,7 @@ export async function toHTML(src, options = {}) {
const {
timeout = 300000,
disableSandbox = false,
disableGPU = false,
devtools = false,
useLocal = false,
} = options;
Expand Down Expand Up @@ -59,6 +61,7 @@ export async function toHTML(src, options = {}) {

const args = [];
if (disableSandbox) args.push("--no-sandbox");
if (disableGPU) args.push("--disable-gpu");

log("Launching browser");
const browser = await puppeteer.launch({
Expand Down

0 comments on commit 365bf67

Please sign in to comment.