diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-05-28 21:04:08 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-05-29 18:06:04 +0200 |
commit | c58cea5a163cd5d7133e00fdf257325ce3807c09 (patch) | |
tree | 1b7f97c0474f1990450a54e82b4432ec37de1956 /deps/npm/lib/utils | |
parent | 88fe7e84e56e44a727169c07ee040cbf67f9c0a8 (diff) | |
download | android-node-v8-c58cea5a163cd5d7133e00fdf257325ce3807c09.tar.gz android-node-v8-c58cea5a163cd5d7133e00fdf257325ce3807c09.tar.bz2 android-node-v8-c58cea5a163cd5d7133e00fdf257325ce3807c09.zip |
deps: upgrade npm to 5.0.0
PR-URL: https://github.com/nodejs/node/pull/13276
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/lib/utils')
-rw-r--r-- | deps/npm/lib/utils/error-handler.js | 10 | ||||
-rw-r--r-- | deps/npm/lib/utils/link.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/utils/package-integrity.js | 21 | ||||
-rw-r--r-- | deps/npm/lib/utils/tar.js | 19 |
4 files changed, 7 insertions, 45 deletions
diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index 8365f39d9d..5374d1feec 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -130,10 +130,12 @@ function exit (code, noLog) { itWorked = !code - // just emit a fake exit event. - // if we're really exiting, then let it exit on its own, so that - // in-process stuff can finish or clean up first. - if (!doExit) process.emit('exit', code) + // Exit directly -- nothing in the CLI should still be running in the + // background at this point, and this makes sure anything left dangling + // for whatever reason gets thrown away, instead of leaving the CLI open + // + // Commands that expect long-running actions should just delay `cb()` + process.exit(code) } } diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 605b77402c..15331740a4 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -64,7 +64,7 @@ function link (from, to, gently, abs, cb) { [ [ensureFromIsNotSource, absTarget, to], [fs, 'stat', absTarget], - [rm, to, gently], + [rm, to, gently, path.dirname(to)], [mkdir, path.dirname(to)], [fs, 'symlink', target, to, 'junction'] ], diff --git a/deps/npm/lib/utils/package-integrity.js b/deps/npm/lib/utils/package-integrity.js deleted file mode 100644 index f9560d660e..0000000000 --- a/deps/npm/lib/utils/package-integrity.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -// Utilities for generating and verifying the packageIntegrity field for -// package-lock -// -// Spec: https://github.com/npm/npm/pull/16441 - -const ssri = require('ssri') -const SSRI_OPTS = { - algorithms: ['sha512'] -} - -module.exports.check = check -function check (pkg, integrity) { - return ssri.checkData(JSON.stringify(pkg), integrity, SSRI_OPTS) -} - -module.exports.hash = hash -function hash (pkg) { - return ssri.fromData(JSON.stringify(pkg), SSRI_OPTS).toString() -} diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index 7ebc9d6875..ebbee025a2 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -3,8 +3,6 @@ // commands for packing and unpacking tarballs // this file is used by lib/cache.js -const BB = require('bluebird') - var fs = require('graceful-fs') var path = require('path') var writeFileAtomic = require('write-file-atomic') @@ -28,11 +26,6 @@ var moduleName = require('./module-name.js') var packageId = require('./package-id.js') var pulseTillDone = require('../utils/pulse-till-done.js') -const cacache = require('cacache') -const packAsync = BB.promisify(pack) -const PassThrough = require('stream').PassThrough -const pipe = BB.promisify(require('mississippi').pipe) - if (process.env.SUDO_UID && myUid === 0) { if (!isNaN(process.env.SUDO_UID)) myUid = +process.env.SUDO_UID if (!isNaN(process.env.SUDO_GID)) myGid = +process.env.SUDO_GID @@ -41,18 +34,6 @@ if (process.env.SUDO_UID && myUid === 0) { exports.pack = pack exports.unpack = unpack -module.exports.packToStream = packToStream -function packToStream (mani, dir) { - const stream = new PassThrough() - cacache.tmp.withTmp(npm.tmp, (tmp) => { - const tmpTarget = path.join(tmp, 'package.tgz') - return packAsync(tmpTarget, dir, mani).then(() => { - return pipe(fs.createReadStream(tmpTarget), stream) - }) - }).catch((err) => stream.emit('error', err)) - return stream -} - function pack (tarball, folder, pkg, cb) { log.verbose('tar pack', [tarball, folder]) |