diff --git a/common/changes/@microsoft/rush/sennyeya-prevent-errors-on-before-execute_2024-07-28-22-23.json b/common/changes/@microsoft/rush/sennyeya-prevent-errors-on-before-execute_2024-07-28-22-23.json new file mode 100644 index 00000000000..964eeb4bf15 --- /dev/null +++ b/common/changes/@microsoft/rush/sennyeya-prevent-errors-on-before-execute_2024-07-28-22-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix a bug that caused the build cache to close its terminal writer before execution on error.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} diff --git a/libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts b/libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts index ae044c45bf2..a29db3d9c97 100644 --- a/libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts +++ b/libraries/rush-lib/src/logic/operations/CacheableOperationPlugin.ts @@ -402,13 +402,7 @@ export class CacheableOperationPlugin implements IPhasedCommandPlugin { } }; - try { - const earlyReturnStatus: OperationStatus | undefined = await runBeforeExecute(); - return earlyReturnStatus; - } catch (e) { - buildCacheContext.buildCacheProjectLogWritable?.close(); - throw e; - } + return await runBeforeExecute(); } );