Skip to content

Commit 872b9c9

Browse files
fix(core): remove unused getTerminalOutput from BatchProcess (#34604)
## Current Behavior `BatchProcess` accumulates all stdout/stderr output in `terminalOutputChunks` and exposes it via `getTerminalOutput()`, but nothing ever calls `getTerminalOutput()`. The accumulated strings are unique allocations (created via `chunk.toString()`), not shared with the output callbacks or `process.stdout.write`. For verbose batched tasks (e.g., Maven/Gradle with hundreds of tasks), this can hold tens to hundreds of MB for the entire batch duration. ## Expected Behavior Remove the dead accumulation code. stdout/stderr chunks are still forwarded to `process.stdout`/`process.stderr` and output callbacks as before — only the unused storage is removed. --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
1 parent 1e3f8e0 commit 872b9c9

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

packages/nx/src/tasks-runner/running-tasks/batch-process.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ export class BatchProcess {
1414
(task: string, result: TaskResult) => void
1515
> = [];
1616
private outputCallbacks: Array<(output: string) => void> = [];
17-
private terminalOutputChunks: string[] = [];
18-
private joinedTerminalOutput: string | undefined;
1917

2018
constructor(
2119
private childProcess: ChildProcess,
@@ -59,7 +57,6 @@ export class BatchProcess {
5957
if (this.childProcess.stdout) {
6058
this.childProcess.stdout.on('data', (chunk) => {
6159
const output = chunk.toString();
62-
this.terminalOutputChunks.push(output);
6360

6461
// Maintain current terminal output behavior
6562
process.stdout.write(chunk);
@@ -75,7 +72,6 @@ export class BatchProcess {
7572
if (this.childProcess.stderr) {
7673
this.childProcess.stderr.on('data', (chunk) => {
7774
const output = chunk.toString();
78-
this.terminalOutputChunks.push(output);
7975

8076
// Maintain current terminal output behavior
8177
process.stderr.write(chunk);
@@ -134,9 +130,4 @@ export class BatchProcess {
134130
this.childProcess.kill(signal);
135131
}
136132
}
137-
138-
getTerminalOutput(): string {
139-
this.joinedTerminalOutput ??= this.terminalOutputChunks.join('');
140-
return this.joinedTerminalOutput;
141-
}
142133
}

0 commit comments

Comments
 (0)