aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/graceful-fs/polyfills.js
diff options
context:
space:
mode:
authorclaudiahdz <cghr1990@gmail.com>2019-09-03 17:51:04 -0500
committerRich Trott <rtrott@gmail.com>2019-09-17 18:51:21 -0700
commit17e420b23f5462db9f1951d98233fdaee889c721 (patch)
treec0f855138f734517aeba81000ebeac9d6e271563 /deps/npm/node_modules/graceful-fs/polyfills.js
parent7fa03b54c88f930d24f2f0e2ceb0e94dc5a6ad77 (diff)
downloadandroid-node-v8-17e420b23f5462db9f1951d98233fdaee889c721.tar.gz
android-node-v8-17e420b23f5462db9f1951d98233fdaee889c721.tar.bz2
android-node-v8-17e420b23f5462db9f1951d98233fdaee889c721.zip
deps: update npm to 6.11.3
PR-URL: https://github.com/nodejs/node/pull/29430 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/graceful-fs/polyfills.js')
-rw-r--r--deps/npm/node_modules/graceful-fs/polyfills.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/deps/npm/node_modules/graceful-fs/polyfills.js b/deps/npm/node_modules/graceful-fs/polyfills.js
index ab692016c9..a5808d23f1 100644
--- a/deps/npm/node_modules/graceful-fs/polyfills.js
+++ b/deps/npm/node_modules/graceful-fs/polyfills.js
@@ -115,20 +115,26 @@ function patch (fs) {
}
// if read() returns EAGAIN, then just try it again.
- fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) {
- var callback
- if (callback_ && typeof callback_ === 'function') {
- var eagCounter = 0
- callback = function (er, _, __) {
- if (er && er.code === 'EAGAIN' && eagCounter < 10) {
- eagCounter ++
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
+ fs.read = (function (fs$read) {
+ function read (fd, buffer, offset, length, position, callback_) {
+ var callback
+ if (callback_ && typeof callback_ === 'function') {
+ var eagCounter = 0
+ callback = function (er, _, __) {
+ if (er && er.code === 'EAGAIN' && eagCounter < 10) {
+ eagCounter ++
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback)
+ }
+ callback_.apply(this, arguments)
}
- callback_.apply(this, arguments)
}
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
- }})(fs.read)
+
+ // This ensures `util.promisify` works as it does for native `fs.read`.
+ read.__proto__ = fs$read
+ return read
+ })(fs.read)
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
var eagCounter = 0