Skip to content

Commit 5163741

Browse files
committed
do not overwrite process.env and Linux-only fix
1 parent 27deb29 commit 5163741

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/worker/lib/workerLib.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ export class Parent extends RequesterResponder {
231231
/** start worker */
232232
startWorker(childJsPath: string, terminalError: (e: Error) => any, customArguments: string[]) {
233233
try {
234-
var spawnEnv = process.env;
234+
/** At least on NixOS, the environment must be preserved for
235+
dynamic libraries to be properly linked.
236+
On Windows/MacOS, it needs to be cleared, cf. atom/atom#2887 */
237+
var spawnEnv = (process.platform === 'linux') ? Object.create(process.env) : {};
235238
spawnEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
236239
this.child = spawn(this.node, [
237240
// '--debug', // Uncomment if you want to debug the child process

0 commit comments

Comments
 (0)