1/* eslint camelcase: "off" */ 2const setPATH = require('./set-path.js') 3const { resolve } = require('path') 4const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') 5 6const makeSpawnArgs = options => { 7 const { 8 event, 9 path, 10 scriptShell = true, 11 binPaths, 12 env, 13 stdio, 14 cmd, 15 args, 16 stdioString, 17 } = options 18 19 const spawnEnv = setPATH(path, binPaths, { 20 // we need to at least save the PATH environment var 21 ...process.env, 22 ...env, 23 npm_package_json: resolve(path, 'package.json'), 24 npm_lifecycle_event: event, 25 npm_lifecycle_script: cmd, 26 npm_config_node_gyp, 27 }) 28 29 const spawnOpts = { 30 env: spawnEnv, 31 stdioString, 32 stdio, 33 cwd: path, 34 shell: scriptShell, 35 } 36 37 return [cmd, args, spawnOpts] 38} 39 40module.exports = makeSpawnArgs 41