build: remove enable_run_as_node build flag (#38413)

* feat: remove enable_run_as_node flag

* drop features.isRunAsNodeEnabled()

* use IsEnvSet() helper in electron_main_linux.cc

* cleanup [[maybe_unused]]

---------

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
Milan Burda 2023-06-08 22:40:08 +02:00 committed by GitHub
parent 806f00285c
commit 05d39d8313
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 29 additions and 96 deletions

View file

@ -8,7 +8,6 @@ import { webContents } from 'electron/main';
import { EventEmitter } from 'stream';
import { once } from 'events';
const features = process._linkedBinding('electron_common_features');
const mainFixturesPath = path.resolve(__dirname, 'fixtures');
describe('node feature', () => {
@ -26,7 +25,7 @@ describe('node feature', () => {
});
});
ifdescribe(features.isRunAsNodeEnabled())('child_process in renderer', () => {
describe('child_process in renderer', () => {
useRemoteContext();
describe('child_process.fork', () => {
@ -360,7 +359,7 @@ describe('node feature', () => {
});
});
ifdescribe(features.isRunAsNodeEnabled() && process.platform === 'darwin')('net.connect', () => {
ifdescribe(process.platform === 'darwin')('net.connect', () => {
itremote('emit error when connect to a socket path without listeners', async (fixtures: string) => {
const socketPath = require('path').join(require('os').tmpdir(), 'electron-test.sock');
const script = require('path').join(fixtures, 'module', 'create_socket.js');
@ -660,7 +659,7 @@ describe('node feature', () => {
});
});
ifdescribe(features.isRunAsNodeEnabled())('Node.js cli flags', () => {
describe('Node.js cli flags', () => {
let child: childProcess.ChildProcessWithoutNullStreams;
let exitPromise: Promise<any[]>;
@ -713,7 +712,7 @@ describe('node feature', () => {
});
});
ifdescribe(features.isRunAsNodeEnabled())('inspector', () => {
describe('inspector', () => {
let child: childProcess.ChildProcessWithoutNullStreams;
let exitPromise: Promise<any[]> | null;
@ -856,7 +855,7 @@ describe('node feature', () => {
expect(result.status).to.equal(0);
});
ifit(features.isRunAsNodeEnabled())('handles Promise timeouts correctly', async () => {
it('handles Promise timeouts correctly', async () => {
const scriptPath = path.join(fixtures, 'module', 'node-promise-timer.js');
const child = childProcess.spawn(process.execPath, [scriptPath], {
env: { ELECTRON_RUN_AS_NODE: 'true' }