azure-pipelines-task-lib 5.2.4 → 5.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/task.js +20 -4
package/package.json
CHANGED
package/task.js
CHANGED
|
@@ -977,7 +977,7 @@ function ls(optionsOrPaths) {
|
|
|
977
977
|
if (!includeHidden && entrybasename.startsWith('.') && entrybasename !== '.' && entrybasename !== '..') {
|
|
978
978
|
return "continue";
|
|
979
979
|
}
|
|
980
|
-
var baseDir = pathsCopy
|
|
980
|
+
var baseDir = safeFind(pathsCopy, function (p) { return entry.startsWith(path.resolve(p)); }) || path.resolve('.');
|
|
981
981
|
if (fs.lstatSync(entry).isDirectory() && isRecursive) {
|
|
982
982
|
preparedPaths.push.apply(preparedPaths, fs.readdirSync(entry).map(function (x) { return path.join(entry, x); }));
|
|
983
983
|
entries.push(path.relative(baseDir, entry));
|
|
@@ -1522,7 +1522,7 @@ function rmRF(inputPath) {
|
|
|
1522
1522
|
var lstats = fs.lstatSync(inputPath);
|
|
1523
1523
|
if (lstats.isDirectory() && !lstats.isSymbolicLink()) {
|
|
1524
1524
|
(0, exports.debug)('removing directory ' + inputPath);
|
|
1525
|
-
childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", inputPath]);
|
|
1525
|
+
childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", im._normalizeSeparators(inputPath)]);
|
|
1526
1526
|
}
|
|
1527
1527
|
else if (lstats.isSymbolicLink()) {
|
|
1528
1528
|
(0, exports.debug)('removing symbolic link ' + inputPath);
|
|
@@ -1530,7 +1530,7 @@ function rmRF(inputPath) {
|
|
|
1530
1530
|
if (fs.existsSync(realPath)) {
|
|
1531
1531
|
var stats_4 = fs.statSync(realPath);
|
|
1532
1532
|
if (stats_4.isDirectory()) {
|
|
1533
|
-
childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", realPath]);
|
|
1533
|
+
childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", im._normalizeSeparators(realPath)]);
|
|
1534
1534
|
fs.unlinkSync(inputPath);
|
|
1535
1535
|
}
|
|
1536
1536
|
else {
|
|
@@ -1544,7 +1544,7 @@ function rmRF(inputPath) {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
else {
|
|
1546
1546
|
(0, exports.debug)('removing file ' + inputPath);
|
|
1547
|
-
childProcess.execFileSync("cmd.exe", ["/c", "del", "/f", "/a", inputPath]);
|
|
1547
|
+
childProcess.execFileSync("cmd.exe", ["/c", "del", "/f", "/a", im._normalizeSeparators(inputPath)]);
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
1550
|
catch (err) {
|
|
@@ -2404,3 +2404,19 @@ if (!global['_vsts_task_lib_loaded']) {
|
|
|
2404
2404
|
im._exposeProxySettings();
|
|
2405
2405
|
im._exposeCertSettings();
|
|
2406
2406
|
}
|
|
2407
|
+
//Helper Functions for internal use only
|
|
2408
|
+
/**
|
|
2409
|
+
* safeFind - safe replacement for Array.prototype.find
|
|
2410
|
+
*
|
|
2411
|
+
* @param {Array} arr - the array to search
|
|
2412
|
+
* @param {Function} predicate - function to test each element, returns true if match
|
|
2413
|
+
* @returns {*} - first element that matches or undefined
|
|
2414
|
+
*/
|
|
2415
|
+
function safeFind(arr, predicate) {
|
|
2416
|
+
for (var i = 0; i < arr.length; i++) {
|
|
2417
|
+
if (predicate(arr[i])) {
|
|
2418
|
+
return arr[i];
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
return undefined;
|
|
2422
|
+
}
|