From b1a6f7e780977bca5aff8024751e7690ef4e5161 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 8 Aug 2024 18:12:03 +0200 Subject: [PATCH] ELECTRON_RUN_AS_NODE is removed too late before bootstrap-amd.js redefines 'fs' (fix #225139) (#225141) --- src/server-cli.js | 7 ++++--- src/server-main.js | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server-cli.js b/src/server-cli.js index dc7fa459f03..559af5e422c 100644 --- a/src/server-cli.js +++ b/src/server-cli.js @@ -6,6 +6,10 @@ // @ts-check 'use strict'; +// Keep bootstrap-amd.js from redefining 'fs'. +// TODO@esm this needs to be revisited in ESM +delete process.env['ELECTRON_RUN_AS_NODE']; + // ESM-comment-begin const path = require('path'); const bootstrapNode = require('./bootstrap-node'); @@ -26,9 +30,6 @@ const product = require('./bootstrap-meta').product; async function start() { - // Keep bootstrap-amd.js from redefining 'fs'. - delete process.env['ELECTRON_RUN_AS_NODE']; - // NLS const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname }); process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required for `bootstrap-amd` to pick up NLS messages diff --git a/src/server-main.js b/src/server-main.js index 141101518b9..bc7c383e587 100644 --- a/src/server-main.js +++ b/src/server-main.js @@ -11,6 +11,10 @@ * @import { IServerAPI } from './vs/server/node/remoteExtensionHostAgentServer' */ +// Keep bootstrap-amd.js from redefining 'fs'. +// TODO@esm this needs to be revisited in ESM +delete process.env['ELECTRON_RUN_AS_NODE']; + // ESM-comment-begin const path = require('path'); const http = require('http'); @@ -279,7 +283,6 @@ async function findFreePort(host, start, end) { */ function loadCode(nlsConfiguration) { return new Promise((resolve, reject) => { - delete process.env['ELECTRON_RUN_AS_NODE']; // Keep bootstrap-amd.js from redefining 'fs'. /** @type {INLSConfiguration} */ process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required for `bootstrap-amd` to pick up NLS messages