File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
packages/angular_devkit/core/node Expand file tree Collapse file tree 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> {
264264 delete ( path : Path ) : Observable < void > {
265265 return this . isDirectory ( path ) . pipe (
266266 concatMap ( isDir => {
267+ // TODO: remove this try+catch when issue https://github.com/ReactiveX/rxjs/issues/3740 is
268+ // fixed.
267269 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+ ) ;
277284 } else {
278285 try {
279286 fs . unlinkSync ( getSystemPath ( path ) ) ;
280- } catch ( error ) {
281- return throwError ( error ) ;
287+ } catch ( err ) {
288+ return throwError ( err ) ;
282289 }
283- }
284290
285- return EMPTY ;
291+ return EMPTY ;
292+ }
286293 } ) ,
287294 ) ;
288295 }
You can’t perform that action at this time.
0 commit comments