@@ -4370,11 +4370,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43704370} ;
43714371var _a ;
43724372Object . 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 ;
43744374const fs = __importStar ( __nccwpck_require__ ( 7147 ) ) ;
43754375const 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'
43774380exports . 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 ;
43784384function exists ( fsPath ) {
43794385 return __awaiter ( this , void 0 , void 0 , function * ( ) {
43804386 try {
@@ -4555,12 +4561,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45554561Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
45564562exports . findInPath = exports . which = exports . mkdirP = exports . rmRF = exports . mv = exports . cp = void 0 ;
45574563const assert_1 = __nccwpck_require__ ( 9491 ) ;
4558- const childProcess = __importStar ( __nccwpck_require__ ( 2081 ) ) ;
45594564const path = __importStar ( __nccwpck_require__ ( 1017 ) ) ;
4560- const util_1 = __nccwpck_require__ ( 3837 ) ;
45614565const ioUtil = __importStar ( __nccwpck_require__ ( 1962 ) ) ;
4562- const exec = util_1 . promisify ( childProcess . exec ) ;
4563- const execFile = util_1 . promisify ( childProcess . execFile ) ;
45644566/**
45654567 * Copies a file or folder.
45664568 * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -4641,61 +4643,23 @@ exports.mv = mv;
46414643function rmRF ( inputPath ) {
46424644 return __awaiter ( this , void 0 , void 0 , function * ( ) {
46434645 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.
46464646 // Check for invalid characters
46474647 // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
46484648 if ( / [ * " < > | ] / . test ( inputPath ) ) {
46494649 throw new Error ( 'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows' ) ;
46504650 }
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- }
46804651 }
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 } ` ) ;
46994663 }
47004664 } ) ;
47014665}
0 commit comments