diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js index 8c75ee259e091..de3df47fd5552 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js @@ -21,6 +21,14 @@ if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { function noop () {} +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + var debug = noop if (util.debuglog) debug = util.debuglog('gfs4') @@ -32,14 +40,10 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) } // Once time initialization -if (!global[gracefulQueue]) { +if (!fs[gracefulQueue]) { // This queue can be shared by multiple loaded instances - var queue = [] - Object.defineProperty(global, gracefulQueue, { - get: function() { - return queue - } - }) + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) // Patch fs.close/closeSync to shared queue version, because we need // to retry() whenever a close happens *anywhere* in the program. @@ -79,12 +83,16 @@ if (!global[gracefulQueue]) { if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { process.on('exit', function() { - debug(global[gracefulQueue]) - require('assert').equal(global[gracefulQueue].length, 0) + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) }) } } +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + module.exports = patch(clone(fs)) if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { module.exports = patch(fs) @@ -334,11 +342,11 @@ function patch (fs) { function enqueue (elem) { debug('ENQUEUE', elem[0].name, elem[1]) - global[gracefulQueue].push(elem) + fs[gracefulQueue].push(elem) } function retry () { - var elem = global[gracefulQueue].shift() + var elem = fs[gracefulQueue].shift() if (elem) { debug('RETRY', elem[0].name, elem[1]) elem[0].apply(null, elem[1]) diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index 788876e322073..32518904d9741 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -1,19 +1,19 @@ { - "_from": "graceful-fs@4.2.3", - "_id": "graceful-fs@4.2.3", + "_from": "graceful-fs@4.2.4", + "_id": "graceful-fs@4.2.4", "_inBundle": false, - "_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "_integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "_location": "/graceful-fs", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "graceful-fs@4.2.3", + "raw": "graceful-fs@4.2.4", "name": "graceful-fs", "escapedName": "graceful-fs", - "rawSpec": "4.2.3", + "rawSpec": "4.2.4", "saveSpec": null, - "fetchSpec": "4.2.3" + "fetchSpec": "4.2.4" }, "_requiredBy": [ "#USER", @@ -41,10 +41,10 @@ "/test-exclude/load-json-file", "/write-file-atomic" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "_shasum": "4a12ff1b60376ef09862c2093edd908328be8423", - "_spec": "graceful-fs@4.2.3", - "_where": "/Users/mperrotte/npminc/cli", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "_shasum": "2256bde14d3632958c465ebc96dc467ca07a29fb", + "_spec": "graceful-fs@4.2.4", + "_where": "/Users/ruyadorno/Documents/workspace/cli", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, @@ -98,5 +98,5 @@ "preversion": "npm test", "test": "node test.js | tap -" }, - "version": "4.2.3" + "version": "4.2.4" } diff --git a/package-lock.json b/package-lock.json index fac9353657d73..75d33ddac0613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2371,9 +2371,9 @@ } }, "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" }, "growl": { "version": "1.10.5", diff --git a/package.json b/package.json index 557770e3b7d88..e5188ba25f2dd 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "fs-write-stream-atomic": "~1.0.10", "gentle-fs": "^2.3.0", "glob": "^7.1.6", - "graceful-fs": "^4.2.3", + "graceful-fs": "^4.2.4", "has-unicode": "~2.0.1", "hosted-git-info": "^2.8.8", "iferr": "^1.0.2",