mirror of
https://github.com/nodejs/node.git
synced 2025-08-20 01:15:51 +02:00
deps: upgrade npm to 8.14.0
PR-URL: https://github.com/nodejs/node/pull/43826 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
8657d6db07
commit
dd167ff0ee
133 changed files with 3788 additions and 512 deletions
24
deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js
generated
vendored
24
deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js
generated
vendored
|
|
@ -1,12 +1,19 @@
|
|||
/* eslint camelcase: "off" */
|
||||
const isWindows = require('./is-windows.js')
|
||||
const setPATH = require('./set-path.js')
|
||||
const { chmodSync: chmod, unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
|
||||
const { unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
|
||||
const { tmpdir } = require('os')
|
||||
const { isAbsolute, resolve } = require('path')
|
||||
const { resolve } = require('path')
|
||||
const which = require('which')
|
||||
const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js')
|
||||
const escape = require('./escape.js')
|
||||
const { randomBytes } = require('crypto')
|
||||
|
||||
const translateWinPathToPosix = (path) => {
|
||||
return path
|
||||
.replace(/^([A-z]):/, '/$1')
|
||||
.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
const makeSpawnArgs = options => {
|
||||
const {
|
||||
|
|
@ -30,7 +37,7 @@ const makeSpawnArgs = options => {
|
|||
npm_config_node_gyp,
|
||||
})
|
||||
|
||||
const fileName = escape.filename(`${event}-${Date.now()}`)
|
||||
const fileName = escape.filename(`${event}-${randomBytes(4).toString('hex')}`)
|
||||
let scriptFile
|
||||
let script = ''
|
||||
|
||||
|
|
@ -69,24 +76,17 @@ const makeSpawnArgs = options => {
|
|||
script += ` ${args.map((arg) => escape.cmd(arg, doubleEscape)).join(' ')}`
|
||||
}
|
||||
} else {
|
||||
const shebang = isAbsolute(scriptShell)
|
||||
? `#!${scriptShell}`
|
||||
: `#!/usr/bin/env ${scriptShell}`
|
||||
scriptFile = resolve(tmpdir(), `${fileName}.sh`)
|
||||
script += `${shebang}\n`
|
||||
script += cmd
|
||||
script = cmd
|
||||
if (args.length) {
|
||||
script += ` ${args.map((arg) => escape.sh(arg)).join(' ')}`
|
||||
}
|
||||
}
|
||||
|
||||
writeFile(scriptFile, script)
|
||||
if (!isCmd) {
|
||||
chmod(scriptFile, '0775')
|
||||
}
|
||||
const spawnArgs = isCmd
|
||||
? ['/d', '/s', '/c', escape.cmd(scriptFile)]
|
||||
: ['-c', escape.sh(scriptFile)]
|
||||
: [isWindows ? translateWinPathToPosix(scriptFile) : scriptFile]
|
||||
|
||||
const spawnOpts = {
|
||||
env: spawnEnv,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue