@@ -4370,11 +4370,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
4370
4370
} ;
4371
4371
var _a ;
4372
4372
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
4373
- exports . getCmdPath = exports . tryGetExecutablePath = exports . isRooted = exports . isDirectory = exports . exists = exports . IS_WINDOWS = exports . unlink = exports . symlink = exports . stat = exports . rmdir = exports . rename = exports . readlink = exports . readdir = exports . mkdir = exports . lstat = exports . copyFile = exports . chmod = void 0 ;
4373
+ exports . getCmdPath = exports . tryGetExecutablePath = exports . isRooted = exports . isDirectory = exports . exists = exports . READONLY = exports . UV_FS_O_EXLOCK = exports . IS_WINDOWS = exports . unlink = exports . symlink = exports . stat = exports . rmdir = exports . rm = exports . rename = exports . readlink = exports . readdir = exports . open = exports . mkdir = exports . lstat = exports . copyFile = exports . chmod = void 0 ;
4374
4374
const fs = __importStar ( __nccwpck_require__ ( 7147 ) ) ;
4375
4375
const path = __importStar ( __nccwpck_require__ ( 1017 ) ) ;
4376
- _a = fs . promises , exports . chmod = _a . chmod , exports . copyFile = _a . copyFile , exports . lstat = _a . lstat , exports . mkdir = _a . mkdir , exports . readdir = _a . readdir , exports . readlink = _a . readlink , exports . rename = _a . rename , exports . rmdir = _a . rmdir , exports . stat = _a . stat , exports . symlink = _a . symlink , exports . unlink = _a . unlink ;
4376
+ _a = fs . promises
4377
+ // export const {open} = 'fs'
4378
+ , exports . chmod = _a . chmod , exports . copyFile = _a . copyFile , exports . lstat = _a . lstat , exports . mkdir = _a . mkdir , exports . open = _a . open , exports . readdir = _a . readdir , exports . readlink = _a . readlink , exports . rename = _a . rename , exports . rm = _a . rm , exports . rmdir = _a . rmdir , exports . stat = _a . stat , exports . symlink = _a . symlink , exports . unlink = _a . unlink ;
4379
+ // export const {open} = 'fs'
4377
4380
exports . IS_WINDOWS = process . platform === 'win32' ;
4381
+ // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
4382
+ exports . UV_FS_O_EXLOCK = 0x10000000 ;
4383
+ exports . READONLY = fs . constants . O_RDONLY ;
4378
4384
function exists ( fsPath ) {
4379
4385
return __awaiter ( this , void 0 , void 0 , function * ( ) {
4380
4386
try {
@@ -4555,12 +4561,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
4555
4561
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
4556
4562
exports . findInPath = exports . which = exports . mkdirP = exports . rmRF = exports . mv = exports . cp = void 0 ;
4557
4563
const assert_1 = __nccwpck_require__ ( 9491 ) ;
4558
- const childProcess = __importStar ( __nccwpck_require__ ( 2081 ) ) ;
4559
4564
const path = __importStar ( __nccwpck_require__ ( 1017 ) ) ;
4560
- const util_1 = __nccwpck_require__ ( 3837 ) ;
4561
4565
const ioUtil = __importStar ( __nccwpck_require__ ( 1962 ) ) ;
4562
- const exec = util_1 . promisify ( childProcess . exec ) ;
4563
- const execFile = util_1 . promisify ( childProcess . execFile ) ;
4564
4566
/**
4565
4567
* Copies a file or folder.
4566
4568
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -4641,61 +4643,23 @@ exports.mv = mv;
4641
4643
function rmRF ( inputPath ) {
4642
4644
return __awaiter ( this , void 0 , void 0 , function * ( ) {
4643
4645
if ( ioUtil . IS_WINDOWS ) {
4644
- // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
4645
- // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
4646
4646
// Check for invalid characters
4647
4647
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
4648
4648
if ( / [ * " < > | ] / . test ( inputPath ) ) {
4649
4649
throw new Error ( 'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows' ) ;
4650
4650
}
4651
- try {
4652
- const cmdPath = ioUtil . getCmdPath ( ) ;
4653
- if ( yield ioUtil . isDirectory ( inputPath , true ) ) {
4654
- yield exec ( `${ cmdPath } /s /c "rd /s /q "%inputPath%""` , {
4655
- env : { inputPath }
4656
- } ) ;
4657
- }
4658
- else {
4659
- yield exec ( `${ cmdPath } /s /c "del /f /a "%inputPath%""` , {
4660
- env : { inputPath }
4661
- } ) ;
4662
- }
4663
- }
4664
- catch ( err ) {
4665
- // if you try to delete a file that doesn't exist, desired result is achieved
4666
- // other errors are valid
4667
- if ( err . code !== 'ENOENT' )
4668
- throw err ;
4669
- }
4670
- // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
4671
- try {
4672
- yield ioUtil . unlink ( inputPath ) ;
4673
- }
4674
- catch ( err ) {
4675
- // if you try to delete a file that doesn't exist, desired result is achieved
4676
- // other errors are valid
4677
- if ( err . code !== 'ENOENT' )
4678
- throw err ;
4679
- }
4680
4651
}
4681
- else {
4682
- let isDir = false ;
4683
- try {
4684
- isDir = yield ioUtil . isDirectory ( inputPath ) ;
4685
- }
4686
- catch ( err ) {
4687
- // if you try to delete a file that doesn't exist, desired result is achieved
4688
- // other errors are valid
4689
- if ( err . code !== 'ENOENT' )
4690
- throw err ;
4691
- return ;
4692
- }
4693
- if ( isDir ) {
4694
- yield execFile ( `rm` , [ `-rf` , `${ inputPath } ` ] ) ;
4695
- }
4696
- else {
4697
- yield ioUtil . unlink ( inputPath ) ;
4698
- }
4652
+ try {
4653
+ // note if path does not exist, error is silent
4654
+ yield ioUtil . rm ( inputPath , {
4655
+ force : true ,
4656
+ maxRetries : 3 ,
4657
+ recursive : true ,
4658
+ retryDelay : 300
4659
+ } ) ;
4660
+ }
4661
+ catch ( err ) {
4662
+ throw new Error ( `File was unable to be removed ${ err } ` ) ;
4699
4663
}
4700
4664
} ) ;
4701
4665
}
0 commit comments