From 6f70e9cde5f121e55f1f2a3d39fa2d78f47698a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 17 Aug 2023 08:02:30 +0200 Subject: [PATCH] Support usage in Electron-based application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit especially targeting VS Code fixes #98 relates to asciidoctor/asciidoctor-vscode#731 Signed-off-by: Aurélien Pupier --- lib/XMLHttpRequest.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index bcaab11..be54e92 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -520,7 +520,8 @@ exports.XMLHttpRequest = function () { const output = require('child_process').execSync(`"${process.execPath}" "${scriptPath}" \ --ssl="${ssl}" \ --encoding="${encoding}" \ ---request-options=${JSON.stringify(JSON.stringify(options))}`, { stdio: ['pipe', 'pipe', 'pipe'], input: data, maxBuffer: maxBuffer }) +--request-options=${JSON.stringify(JSON.stringify(options))} \ +--ms-enable-electron-run-as-node`, { stdio: ['pipe', 'pipe', 'pipe'], input: data, maxBuffer: maxBuffer, env: { ...process.env, ELECTRON_RUN_AS_NODE: true } }) const result = JSON.parse(output.toString('utf8')) if (result.error) { throw translateError(result.error, url)