11import { AbstractOutput } from "./AbstractOutput.mjs" ;
2- import { copyFile , mkdir , readdir , readFile , rmdir , stat , writeFile } from "fs/promises" ;
2+ import { copyFile , mkdir , readdir , readFile , rename , rmdir , stat , writeFile } from "fs/promises" ;
33import { dirname , join } from "path" ;
44import { existsSync } from "fs" ;
5- import fs_extra from "fs-extra" ;
65
76/**
87 * Class LocalFolderOutput
@@ -33,20 +32,15 @@ class LocalFolderOutput extends AbstractOutput {
3332 if ( await this . exists ( "." ) ) {
3433 this . log . log ( `Remove exists output` ) ;
3534
36- try {
37- return this . delete ( "." ) ;
38- } catch ( err ) {
39- // TODO: Bug on Windows? (EPERM: operation not permitted (rmdir))
40- this . log . warn ( err ) ;
41- }
35+ await this . delete ( "." ) ;
4236 }
4337 }
4438
4539 /**
4640 * @inheritDoc
4741 */
4842 async applyInputEntry ( entry ) {
49- return entry . applyToFolder ( this . path ) ;
43+ await entry . applyToFolder ( this . path ) ;
5044 }
5145
5246 /**
@@ -69,9 +63,11 @@ class LocalFolderOutput extends AbstractOutput {
6963 * @inheritDoc
7064 */
7165 async rename ( from , to ) {
72- return fs_extra . move ( this . p ( from ) , this . p ( to ) , {
73- overwrite : true
74- } ) ;
66+ if ( await this . output . exists ( to ) ) {
67+ await this . delete ( to ) ;
68+ }
69+
70+ await rename ( this . p ( from ) , this . p ( to ) ) ;
7571 }
7672
7773 /**
@@ -93,7 +89,7 @@ class LocalFolderOutput extends AbstractOutput {
9389 * @inheritDoc
9490 */
9591 async delete ( path ) {
96- return rmdir ( this . p ( path ) , { recursive : true } ) ;
92+ await rmdir ( this . p ( path ) , { recursive : true } ) ;
9793 }
9894
9995 /**
0 commit comments