source: trip-planner-front/node_modules/@npmcli/run-script/lib/make-spawn-args.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/* eslint camelcase: "off" */
2const isWindows = require('./is-windows.js')
3const setPATH = require('./set-path.js')
4const {resolve} = require('path')
5const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js')
6
7const makeSpawnArgs = options => {
8 const {
9 event,
10 path,
11 scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh',
12 env = {},
13 stdio,
14 cmd,
15 stdioString = false,
16 } = options
17
18 const isCmd = /(?:^|\\)cmd(?:\.exe)?$/i.test(scriptShell)
19 const args = isCmd ? ['/d', '/s', '/c', cmd] : ['-c', cmd]
20
21 const spawnOpts = {
22 env: setPATH(path, {
23 // we need to at least save the PATH environment var
24 ...process.env,
25 ...env,
26 npm_package_json: resolve(path, 'package.json'),
27 npm_lifecycle_event: event,
28 npm_lifecycle_script: cmd,
29 npm_config_node_gyp,
30 }),
31 stdioString,
32 stdio,
33 cwd: path,
34 ...(isCmd ? { windowsVerbatimArguments: true } : {}),
35 }
36
37 return [scriptShell, args, spawnOpts]
38}
39
40module.exports = makeSpawnArgs
Note: See TracBrowser for help on using the repository browser.