Skip to content

Commit b166995

Browse files
Copilotdmichon-msft
andcommitted
fix: add preventAutoclose to ProblemCollector, inject strip-colors transform, make line/column optional in patterns, always wire problemCollector
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/d3363f24-2939-4850-85fb-b8b3eafa7a1e
1 parent ded4068 commit b166995

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

libraries/node-core-library/src/FileError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const uuidFileError: string = '37a4c772-2dc8-4c66-89ae-262f8cc1f0c1';
5050
const baseFolderEnvVar: string = 'RUSHSTACK_FILE_ERROR_BASE_FOLDER';
5151

5252
const unixProblemMatcherPattern: IProblemPattern = {
53-
regexp: '^\\[[^\\]]+\\]\\s+(Error|Warning):\\s+([^:]+):(\\d+):(\\d+)\\s+-\\s+(?:\\(([^)]+)\\)\\s+)?(.*)$',
53+
regexp: '^\\[[^\\]]+\\]\\s+(Error|Warning):\\s+([^:\\s]+)(?::(\\d+)(?::(\\d+))?)?\\s+-\\s+(?:\\(([^)]+)\\)\\s+)?(.*)$',
5454
severity: 1,
5555
file: 2,
5656
line: 3,
@@ -61,7 +61,7 @@ const unixProblemMatcherPattern: IProblemPattern = {
6161

6262
const vsProblemMatcherPattern: IProblemPattern = {
6363
regexp:
64-
'^\\[[^\\]]+\\]\\s+(Error|Warning):\\s+([^\\(]+)\\((\\d+),(\\d+)\\)\\s+-\\s+(?:\\(([^)]+)\\)\\s+)?(.*)$',
64+
'^\\[[^\\]]+\\]\\s+(Error|Warning):\\s+([^\\(\\s]+)(?:\\((\\d+)(?:,(\\d+))?\\))?\\s+-\\s+(?:\\(([^)]+)\\)\\s+)?(.*)$',
6565
severity: 1,
6666
file: 2,
6767
line: 3,

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',
@@ -322,14 +324,21 @@ export class OperationExecutionRecord implements IOperationRunnerContext, IOpera
322324
//
323325
// +--> quietModeTransform? --> collatedWriter
324326
// |
325-
// normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable
327+
// normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable?
326328
// |
327329
// +--> stdioSummarizer
328-
const destination: TerminalWritable = projectLogWritable
329-
? new SplitterTransform({
330-
destinations: [projectLogWritable, stdioSummarizer, problemCollector]
331-
})
332-
: stdioSummarizer;
330+
// |
331+
// +--> removeColorsTransform --> problemCollector
332+
const removeColorsTransform: TextRewriterTransform = new TextRewriterTransform({
333+
destination: problemCollector,
334+
removeColors: true
335+
});
336+
337+
const destination: TerminalWritable = new SplitterTransform({
338+
destinations: projectLogWritable
339+
? [projectLogWritable, stdioSummarizer, removeColorsTransform]
340+
: [stdioSummarizer, removeColorsTransform]
341+
});
333342

334343
const stderrLineTransform: StderrLineTransform = new StderrLineTransform({
335344
destination,

0 commit comments

Comments
 (0)