Skip to content

Commit 27deb29

Browse files
committed
fix workerLib's spawn to preserve environment
1 parent 9740e2b commit 27deb29

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/worker/lib/workerLib.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,16 @@ 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;
235+
spawnEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
234236
this.child = spawn(this.node, [
235237
// '--debug', // Uncomment if you want to debug the child process
236238
childJsPath
237-
].concat(customArguments), { cwd: path.dirname(childJsPath), env: { ATOM_SHELL_INTERNAL_RUN_AS_NODE: '1' }, stdio: ['ipc'] });
239+
].concat(customArguments), {
240+
cwd: path.dirname(childJsPath),
241+
env: spawnEnv,
242+
stdio: ['ipc']
243+
});
238244

239245
this.child.on('error', (err) => {
240246
if (err.code === "ENOENT" && err.path === this.node) {

0 commit comments

Comments
 (0)