@@ -6552,11 +6552,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6552
6552
};
6553
6553
var _a;
6554
6554
Object.defineProperty(exports, "__esModule", ({ value: true }));
6555
- 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;
6555
+ 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;
6556
6556
const fs = __importStar(__nccwpck_require__(7147));
6557
6557
const path = __importStar(__nccwpck_require__(1017));
6558
- _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;
6558
+ _a = fs.promises
6559
+ // export const {open} = 'fs'
6560
+ , 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;
6561
+ // export const {open} = 'fs'
6559
6562
exports.IS_WINDOWS = process.platform === 'win32';
6563
+ // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
6564
+ exports.UV_FS_O_EXLOCK = 0x10000000;
6565
+ exports.READONLY = fs.constants.O_RDONLY;
6560
6566
function exists(fsPath) {
6561
6567
return __awaiter(this, void 0, void 0, function* () {
6562
6568
try {
@@ -6737,12 +6743,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6737
6743
Object.defineProperty(exports, "__esModule", ({ value: true }));
6738
6744
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
6739
6745
const assert_1 = __nccwpck_require__(9491);
6740
- const childProcess = __importStar(__nccwpck_require__(2081));
6741
6746
const path = __importStar(__nccwpck_require__(1017));
6742
- const util_1 = __nccwpck_require__(3837);
6743
6747
const ioUtil = __importStar(__nccwpck_require__(1962));
6744
- const exec = util_1.promisify(childProcess.exec);
6745
- const execFile = util_1.promisify(childProcess.execFile);
6746
6748
/**
6747
6749
* Copies a file or folder.
6748
6750
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -6823,61 +6825,23 @@ exports.mv = mv;
6823
6825
function rmRF(inputPath) {
6824
6826
return __awaiter(this, void 0, void 0, function* () {
6825
6827
if (ioUtil.IS_WINDOWS) {
6826
- // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
6827
- // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
6828
6828
// Check for invalid characters
6829
6829
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
6830
6830
if (/[*"<>|]/.test(inputPath)) {
6831
6831
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
6832
6832
}
6833
- try {
6834
- const cmdPath = ioUtil.getCmdPath();
6835
- if (yield ioUtil.isDirectory(inputPath, true)) {
6836
- yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
6837
- env: { inputPath }
6838
- });
6839
- }
6840
- else {
6841
- yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
6842
- env: { inputPath }
6843
- });
6844
- }
6845
- }
6846
- catch (err) {
6847
- // if you try to delete a file that doesn't exist, desired result is achieved
6848
- // other errors are valid
6849
- if (err.code !== 'ENOENT')
6850
- throw err;
6851
- }
6852
- // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
6853
- try {
6854
- yield ioUtil.unlink(inputPath);
6855
- }
6856
- catch (err) {
6857
- // if you try to delete a file that doesn't exist, desired result is achieved
6858
- // other errors are valid
6859
- if (err.code !== 'ENOENT')
6860
- throw err;
6861
- }
6862
6833
}
6863
- else {
6864
- let isDir = false;
6865
- try {
6866
- isDir = yield ioUtil.isDirectory(inputPath);
6867
- }
6868
- catch (err) {
6869
- // if you try to delete a file that doesn't exist, desired result is achieved
6870
- // other errors are valid
6871
- if (err.code !== 'ENOENT')
6872
- throw err;
6873
- return;
6874
- }
6875
- if (isDir) {
6876
- yield execFile(`rm`, [`-rf`, `${inputPath}`]);
6877
- }
6878
- else {
6879
- yield ioUtil.unlink(inputPath);
6880
- }
6834
+ try {
6835
+ // note if path does not exist, error is silent
6836
+ yield ioUtil.rm(inputPath, {
6837
+ force: true,
6838
+ maxRetries: 3,
6839
+ recursive: true,
6840
+ retryDelay: 300
6841
+ });
6842
+ }
6843
+ catch (err) {
6844
+ throw new Error(`File was unable to be removed ${err}`);
6881
6845
}
6882
6846
});
6883
6847
}
0 commit comments