Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 02a6357

Browse files
committed
Hack child_process.fork to use execute script with atom-shell.
1 parent fe6be32 commit 02a6357

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/child_process.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ exports.fork = function(modulePath /*, args, options*/) {
4949
options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
5050
[0, 1, 2, 'ipc'];
5151

52+
// When forking a child script, we setup a special environment to make
53+
// the atom-shell binary run like the upstream node.
54+
if (!options.env) {
55+
options.env = Object.create(process.env);
56+
}
57+
options.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = 1;
58+
59+
// On Mac we use the helper app as node binary.
60+
if (!options.execPath && process.type && process.platform == 'darwin') {
61+
options.execPath = process.helperExecPath;
62+
}
63+
5264
options.execPath = options.execPath || process.execPath;
5365

5466
return spawn(options.execPath, args, options);

0 commit comments

Comments
 (0)