Skip to content

Commit

Permalink
fix node gyp from electron-spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Apr 30, 2019
1 parent 1d019f9 commit 78c4a50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ function get_process_runtime(versions) {
var runtime = 'node';
if (versions['node-webkit']) {
runtime = 'node-webkit';
} else if (versions.electron) {
} else if (versions.electron || process.env.ELECTRON_RUN_AS_NODE) {
// Running in electron or a childProcess.fork of electron
runtime = 'electron';
}
return runtime;
Expand Down
6 changes: 6 additions & 0 deletions test/versioning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ test('should detect runtime for node-webkit and electron', function(t) {
"node-webkit": '0.37.3',
};
t.equal(versioning.get_process_runtime(mock_process_versions3),'node-webkit');
var mock_process_versions4 = {
"node": '0.8.0',
};
process.env.ELECTRON_RUN_AS_NODE = 1;
t.equal(versioning.get_process_runtime(mock_process_versions4), 'electron');
delete process.env.ELECTRON_RUN_AS_NODE;
t.end();
});

Expand Down

0 comments on commit 78c4a50

Please sign in to comment.