azure-pipelines-task-lib 5.2.4 → 5.2.5
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 +17 -1
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));
|
|
@@ -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
|
+
}
|