diff --git a/patches/graceful-fs+4.2.3.patch b/patches/graceful-fs+4.2.3.patch index 125126b21ee8..6a3304b4146e 100644 --- a/patches/graceful-fs+4.2.3.patch +++ b/patches/graceful-fs+4.2.3.patch @@ -1,21 +1,41 @@ diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js -index 8c75ee2..7bf8838 100644 +index 8c75ee2..de3df47 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js -@@ -32,10 +32,10 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) +@@ -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 = [] +- var queue = [] - Object.defineProperty(global, gracefulQueue, { -+ Object.defineProperty(fs, gracefulQueue, { - get: function() { - return queue - } -@@ -79,8 +79,8 @@ if (!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() { @@ -26,7 +46,15 @@ index 8c75ee2..7bf8838 100644 }) } } -@@ -334,11 +334,11 @@ function patch (fs) { + ++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])