File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -170,15 +170,15 @@ export function isReadOnly(operation: Operation): boolean {
170170 * @see https://stackoverflow.com/a/42505874/3027390
171171 */
172172export async function deleteDirectory ( dirPath : string ) : Promise < void > {
173- if ( await exists ( dirPath ) && ( await lstat ( dirPath ) ) . isDirectory ( ) ) {
174- ( await readdir ( dirPath ) ) . forEach ( async ( entry : string ) => {
173+ if ( ( await exists ( dirPath ) ) && ( await lstat ( dirPath ) ) . isDirectory ( ) ) {
174+ await Promise . all ( ( await readdir ( dirPath ) ) . map ( async ( entry : string ) => {
175175 const entryPath = path . join ( dirPath , entry ) ;
176176 if ( ( await lstat ( entryPath ) ) . isDirectory ( ) ) {
177- deleteDirectory ( entryPath ) ;
177+ await deleteDirectory ( entryPath ) ;
178178 } else {
179179 await unlink ( entryPath ) ;
180180 }
181- } ) ;
181+ } ) ) ;
182182 await rmdir ( dirPath ) ;
183183 }
184184}
You can’t perform that action at this time.
0 commit comments