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

Commit

Permalink
Hack child_process.fork to use execute script with atom-shell.
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Feb 18, 2016
1 parent fe6be32 commit 02a6357
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ exports.fork = function(modulePath /*, args, options*/) {
options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
[0, 1, 2, 'ipc'];

// When forking a child script, we setup a special environment to make
// the atom-shell binary run like the upstream node.
if (!options.env) {
options.env = Object.create(process.env);
}
options.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = 1;

// On Mac we use the helper app as node binary.
if (!options.execPath && process.type && process.platform == 'darwin') {
options.execPath = process.helperExecPath;
}

options.execPath = options.execPath || process.execPath;

return spawn(options.execPath, args, options);
Expand Down

0 comments on commit 02a6357

Please sign in to comment.