From d70f7d2b94a3d8410d9e88bd7c330418d3493837 Mon Sep 17 00:00:00 2001 From: minijus <3633549+minijus@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:19:12 +0300 Subject: [PATCH 1/2] fix(core): wrap writing cache hash into try/catch Instead of failing the task run process it will allow the process to continue. Fixes of #6957 --- packages/workspace/src/tasks-runner/cache.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/workspace/src/tasks-runner/cache.ts b/packages/workspace/src/tasks-runner/cache.ts index 9fec4774146a2..ee4e550fa03ff 100644 --- a/packages/workspace/src/tasks-runner/cache.ts +++ b/packages/workspace/src/tasks-runner/cache.ts @@ -1,5 +1,5 @@ import { appRootPath } from '@nrwl/tao/src/utils/app-root'; -import { Task } from '@nrwl/devkit'; +import { logger, Task } from '@nrwl/devkit'; import { existsSync, mkdirSync, @@ -151,7 +151,12 @@ export class Cache { recordOutputsHash(outputs: string[], hash: string): void { outputs.forEach((output) => { const hashFile = this.getFileNameWithLatestRecordedHashForOutput(output); - writeToFile(hashFile, hash); + try { + writeToFile(hashFile, hash); + } catch (error) { + logger.log(`Error writing hashFile: ${hashFile}.`); + logger.log(error); + } }); } From f6b611e4e9021f8c0f89d91e349c502380e27166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Fri, 1 Oct 2021 14:23:21 +0100 Subject: [PATCH 2/2] fix(core): ignore errors writing latest output hash cache files --- packages/workspace/src/tasks-runner/cache.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/workspace/src/tasks-runner/cache.ts b/packages/workspace/src/tasks-runner/cache.ts index ee4e550fa03ff..5a7e6c0a837e2 100644 --- a/packages/workspace/src/tasks-runner/cache.ts +++ b/packages/workspace/src/tasks-runner/cache.ts @@ -1,5 +1,5 @@ import { appRootPath } from '@nrwl/tao/src/utils/app-root'; -import { logger, Task } from '@nrwl/devkit'; +import { Task } from '@nrwl/devkit'; import { existsSync, mkdirSync, @@ -153,10 +153,7 @@ export class Cache { const hashFile = this.getFileNameWithLatestRecordedHashForOutput(output); try { writeToFile(hashFile, hash); - } catch (error) { - logger.log(`Error writing hashFile: ${hashFile}.`); - logger.log(error); - } + } catch {} }); }