Fix packaged node entrypoint env preservation

This commit is contained in:
Mohamed Boudra
2026-04-26 18:34:29 +07:00
parent f79af3ffbf
commit d672bc19de
2 changed files with 59 additions and 17 deletions
@@ -1,10 +1,5 @@
import { pathToFileURL } from "node:url";
export function sanitizeNodeEntrypointEnv(env: NodeJS.ProcessEnv = process.env): void {
delete env.ELECTRON_RUN_AS_NODE;
delete env.ELECTRON_NO_ATTACH_CONSOLE;
}
export async function main(): Promise<void> {
const [argvMode, entryPath, ...args] = process.argv.slice(2);
if (argvMode !== "bare" && argvMode !== "node-script") {
@@ -18,7 +13,6 @@ export async function main(): Promise<void> {
argvMode === "bare"
? [process.argv[0] ?? "node", ...args]
: [process.argv[0] ?? "node", entryPath, ...args];
sanitizeNodeEntrypointEnv();
await import(pathToFileURL(entryPath).href);
}