File tree 1 file changed +20
-13
lines changed
packages/angular_devkit/core/node
1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -264,25 +264,32 @@ export class NodeJsSyncHost implements virtualFs.Host<fs.Stats> {
264
264
delete ( path : Path ) : Observable < void > {
265
265
return this . isDirectory ( path ) . pipe (
266
266
concatMap ( isDir => {
267
+ // TODO: remove this try+catch when issue https://github.com/ReactiveX/rxjs/issues/3740 is
268
+ // fixed.
267
269
if ( isDir ) {
268
- // Since this is synchronous, we can recurse and safely ignore the result.
269
- for ( const name of fs . readdirSync ( getSystemPath ( path ) ) ) {
270
- this . delete ( join ( path , name ) ) . subscribe ( ) ;
271
- }
272
- try {
273
- fs . rmdirSync ( getSystemPath ( path ) ) ;
274
- } catch ( error ) {
275
- return throwError ( error ) ;
276
- }
270
+ const dirPaths = fs . readdirSync ( getSystemPath ( path ) ) ;
271
+ const rmDirComplete = new Observable ( ( obs ) => {
272
+ try {
273
+ fs . rmdirSync ( getSystemPath ( path ) ) ;
274
+ obs . complete ( ) ;
275
+ } catch ( e ) {
276
+ obs . error ( e ) ;
277
+ }
278
+ } ) ;
279
+
280
+ return concat (
281
+ ...dirPaths . map ( name => this . delete ( join ( path , name ) ) ) ,
282
+ rmDirComplete ,
283
+ ) ;
277
284
} else {
278
285
try {
279
286
fs . unlinkSync ( getSystemPath ( path ) ) ;
280
- } catch ( error ) {
281
- return throwError ( error ) ;
287
+ } catch ( err ) {
288
+ return throwError ( err ) ;
282
289
}
283
- }
284
290
285
- return EMPTY ;
291
+ return EMPTY ;
292
+ }
286
293
} ) ,
287
294
) ;
288
295
}
You can’t perform that action at this time.
0 commit comments