Projects
openEuler:24.03:SP1:Everything:64G
nodejs-readdirp
_service:tar_scm:nodejs-readdirp-pause.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:nodejs-readdirp-pause.patch of Package nodejs-readdirp
commit 4145b1c18762a46af04be129aec48eed30754956 Author: Tom Hughes <tom@compton.nu> Date: Thu Dec 31 12:18:02 2015 +0000 Wait until the next tick to pause the stream Registering handlers on a stream with `on` causes resume to be called, but only on the next tick. This leads to a race condition where the pause can happen before that delayed resume, which then resumes the stream earlier than we were expecting. diff --git a/test/readdirp-stream.js b/test/readdirp-stream.js index c43d132..e45bab5 100644 --- a/test/readdirp-stream.js +++ b/test/readdirp-stream.js @@ -252,16 +252,19 @@ test('\napi separately', function (t) { t.equals(data, processedData, 'emits the buffered data'); t.ok(resumed, 'emits data only after it was resumed'); }) - .pause() - api.processEntry(processedData); - api.handleError(nonfatalError); - api.handleFatalError(fatalError); + process.nextTick(function() { + api.stream.pause(); + + api.processEntry(processedData); + api.handleError(nonfatalError); + api.handleFatalError(fatalError); - setTimeout(function () { - resumed = true; - api.stream.resume(); - }, 1) + setTimeout(function () { + resumed = true; + api.stream.resume(); + }, 1) + }) }) t.test('\n# when a stream is paused it stops walking the fs', function (t) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2