Skip to content

Commit 1a4e287

Browse files
[rush] fix: wire ProblemCollector correctly into the terminal pipeline (#5707)
* fix: add preventAutoclose to ProblemCollector, inject strip-colors transform, always wire problemCollector Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/8b2eb275-c191-44e9-8d69-dd1c166c7985 * fix: add @microsoft/rush patch change file Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/1bcedf3e-f266-4978-ad80-c7ccb325056a --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
1 parent 9cf810a commit 1a4e287

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Fix ProblemCollector wiring in OperationExecutionRecord: add preventAutoclose, strip ANSI colors before matching, and always include problemCollector in the terminal pipeline",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

libraries/rush-lib/src/logic/operations/OperationExecutionRecord.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export class OperationExecutionRecord implements IOperationRunnerContext, IOpera
114114
preventAutoclose: true
115115
});
116116
public readonly problemCollector: ProblemCollector = new ProblemCollector({
117+
// Allow writing to this object after transforms have been closed. We clean it up manually in a finally block.
118+
preventAutoclose: true,
117119
matcherJson: [
118120
{
119121
name: 'rushstack-file-error-unix',
@@ -324,14 +326,21 @@ export class OperationExecutionRecord implements IOperationRunnerContext, IOpera
324326
//
325327
// +--> quietModeTransform? --> collatedWriter
326328
// |
327-
// normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable
329+
// normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable?
328330
// |
329331
// +--> stdioSummarizer
330-
const destination: TerminalWritable = projectLogWritable
331-
? new SplitterTransform({
332-
destinations: [projectLogWritable, stdioSummarizer, problemCollector]
333-
})
334-
: stdioSummarizer;
332+
// |
333+
// +--> removeColorsTransform --> problemCollector
334+
const removeColorsTransform: TextRewriterTransform = new TextRewriterTransform({
335+
destination: problemCollector,
336+
removeColors: true
337+
});
338+
339+
const destination: TerminalWritable = new SplitterTransform({
340+
destinations: projectLogWritable
341+
? [projectLogWritable, stdioSummarizer, removeColorsTransform]
342+
: [stdioSummarizer, removeColorsTransform]
343+
});
335344

336345
const stderrLineTransform: StderrLineTransform = new StderrLineTransform({
337346
destination,

0 commit comments

Comments
 (0)