Skip to content

Commit c12c5a4

Browse files
committed
fix node-pre-gyp spawn on windows with node 18+
spawning cmd files without shell: true wasn't really allowed before, but not it's expressly disallowed because of a recent vulnerability reported to node
1 parent c024dfb commit c12c5a4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lifecycleScripts/install.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ module.exports = function install() {
2929
}
3030

3131
return new Promise(function(resolve, reject) {
32+
const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js");
3233
var spawnedNodePreGyp = spawn(nodePreGyp, args, {
33-
env: Object.assign({}, process.env, {
34-
npm_config_node_gyp: path.join(__dirname, "..", "node_modules",
35-
"node-gyp", "bin", "node-gyp.js")
36-
})
34+
env: {
35+
...process.env,
36+
npm_config_node_gyp: gypPath
37+
},
38+
shell: process.platform === "win32"
3739
});
3840

3941
spawnedNodePreGyp.stdout.on("data", function(data) {

0 commit comments

Comments
 (0)