Skip to content

Commit

Permalink
Merge pull request #6881 from navin22/users/navb/ignoringerrorsforsym…
Browse files Browse the repository at this point in the history
…links

Retrying for findMatch without following symlink on exception.
  • Loading branch information
SadagopanRajaram authored Apr 10, 2018
2 parents c1d65ba + a9c8bd7 commit 3e29d1c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Tasks/PublishTestResults/publishtestresults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,21 @@ async function run() {
searchFolder = tl.getVariable('System.DefaultWorkingDirectory');
}

let matchingTestResultsFiles: string[] = tl.findMatch(searchFolder, testResultsFiles);
let matchingTestResultsFiles: string [];
try {
matchingTestResultsFiles = tl.findMatch(searchFolder, testResultsFiles);
}
catch(error) {
tl.debug('Error in find matching files : ' + error);
tl.debug('Trying without following symlinks.');
// Will remove this once we have right api in vsts-task-lib.
const findOptions = <tl.FindOptions>{
followSpecifiedSymbolicLink: false,
followSymbolicLinks: false
};
matchingTestResultsFiles = tl.findMatch(searchFolder, testResultsFiles, findOptions);
}

const testResultsFilesCount = matchingTestResultsFiles ? matchingTestResultsFiles.length : 0;

tl.debug(`Detected ${testResultsFilesCount} test result files`)
Expand Down

0 comments on commit 3e29d1c

Please sign in to comment.