Skip to content

Commit

Permalink
new patch
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 27, 2020
1 parent f73a721 commit 37413b1
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions 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() {
Expand All @@ -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])
Expand Down

0 comments on commit 37413b1

Please sign in to comment.