From 80eaeb9ab15421bcffa060bdb8c03b3f61175968 Mon Sep 17 00:00:00 2001 From: Denis Rumyantsev <61472718+DenisRumyantsev@users.noreply.github.com> Date: Fri, 16 Jul 2021 14:48:31 +0300 Subject: [PATCH] Skipping the file if it was not found (#774) Implemented checking for the presence of a file and skipping it if it does not exist --- node/package-lock.json | 2 +- node/package.json | 2 +- node/task.ts | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/node/package-lock.json b/node/package-lock.json index 7dda9bcf1..47935c113 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -1,6 +1,6 @@ { "name": "azure-pipelines-task-lib", - "version": "3.1.4", + "version": "3.1.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/node/package.json b/node/package.json index de8329974..1339ac727 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "azure-pipelines-task-lib", - "version": "3.1.4", + "version": "3.1.5", "description": "Azure Pipelines Task SDK", "main": "./task.js", "typings": "./task.d.ts", diff --git a/node/task.ts b/node/task.ts index c826bfb05..2a508c8fa 100644 --- a/node/task.ts +++ b/node/task.ts @@ -857,6 +857,10 @@ export function find(findPath: string, options?: FindOptions): string[] { while (stack.length) { // pop the next item and push to the result array let item = stack.pop()!; // non-null because `stack.length` was truthy + if (!fs.existsSync(item.path)) { + debug(`File "${item.path}" seems to be removed during find operation execution - so skipping it.`); + continue; + } result.push(item.path); // stat the item. the stat info is used further below to determine whether to traverse deeper