File tree Expand file tree Collapse file tree 2 files changed +42
-12
lines changed Expand file tree Collapse file tree 2 files changed +42
-12
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ function globStream(globs, opt) {
261
261
var stream = new Readable ( {
262
262
highWaterMark : ourOpt . highWaterMark ,
263
263
read : read ,
264
+ open : open ,
264
265
predestroy : predestroy ,
265
266
} ) ;
266
267
@@ -277,19 +278,23 @@ function globStream(globs, opt) {
277
278
walker . on ( 'path' , onPath ) ;
278
279
walker . once ( 'end' , onEnd ) ;
279
280
walker . once ( 'error' , onError ) ;
280
- ourGlobs . forEach ( function ( glob ) {
281
- if ( isGlob ( glob ) ) {
282
- // We only want to walk the glob-parent directories of any positive glob
283
- // to reduce the amount of files have to check.
284
- if ( isPositiveGlob ( glob ) ) {
285
- var base = globParent ( glob ) ;
286
- walker . walk ( base ) ;
281
+
282
+ function open ( cb ) {
283
+ ourGlobs . forEach ( function ( glob ) {
284
+ if ( isGlob ( glob ) ) {
285
+ // We only want to walk the glob-parent directories of any positive glob
286
+ // to reduce the amount of files have to check.
287
+ if ( isPositiveGlob ( glob ) ) {
288
+ var base = globParent ( glob ) ;
289
+ walker . walk ( base ) ;
290
+ }
291
+ } else {
292
+ // If the string is not a glob, we just check for the existence of it.
293
+ walker . exists ( glob ) ;
287
294
}
288
- } else {
289
- // If the strig is not a glob, we just check for the existence of it.
290
- walker . exists ( glob ) ;
291
- }
292
- } ) ;
295
+ } ) ;
296
+ cb ( ) ;
297
+ }
293
298
294
299
function read ( cb ) {
295
300
walker . resume ( ) ;
Original file line number Diff line number Diff line change @@ -887,6 +887,31 @@ function suite(moduleName) {
887
887
done
888
888
) ;
889
889
} ) ;
890
+
891
+ it ( 'does not end prematurely' , function ( done ) {
892
+ var gs = globStream ( [ './fixtures/*.js' ] , { cwd : dir } ) ;
893
+
894
+ function delayed ( ) {
895
+ stream . pipeline (
896
+ [
897
+ gs ,
898
+ new stream . Transform ( {
899
+ objectMode : true ,
900
+ transform : function ( data , enc , cb ) {
901
+ if ( typeof enc === 'function' ) {
902
+ cb = enc ;
903
+ }
904
+ cb ( null , data ) ;
905
+ }
906
+ } ) ,
907
+ concat ( ) ,
908
+ ] ,
909
+ done
910
+ ) ;
911
+ }
912
+
913
+ setTimeout ( delayed , 10 ) ;
914
+ } ) ;
890
915
} ) ;
891
916
892
917
describe ( 'options' , function ( ) {
You can’t perform that action at this time.
0 commit comments