Skip to content

Commit

Permalink
fix node-pre-gyp spawn on windows with node 18+
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zawata committed Apr 12, 2024
1 parent c024dfb commit c12c5a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lifecycleScripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ module.exports = function install() {
}

return new Promise(function(resolve, reject) {
const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js");
var spawnedNodePreGyp = spawn(nodePreGyp, args, {
env: Object.assign({}, process.env, {
npm_config_node_gyp: path.join(__dirname, "..", "node_modules",
"node-gyp", "bin", "node-gyp.js")
})
env: {
...process.env,
npm_config_node_gyp: gypPath
},
shell: process.platform === "win32"
});

spawnedNodePreGyp.stdout.on("data", function(data) {
Expand Down

0 comments on commit c12c5a4

Please sign in to comment.