fix(core): fix issue with summary missing outputs (#30819)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Some tasks end but don't have their terminal outputs printed. When that is the case, an error occurred where task terminal output was attempted to be printed but did not exist. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Tracking terminal outputs is restored to being part of printing task terminal output.. and printing task terminal output is guaranteed when pseudo terminal is used. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
59d92af548
commit
16fc5517f0
@ -224,6 +224,13 @@ export class ForkedProcessTaskRunner {
|
||||
}
|
||||
this.pseudoTerminals.delete(pseudoTerminal);
|
||||
this.processes.delete(p);
|
||||
if (!streamOutput) {
|
||||
this.options.lifeCycle.printTaskTerminalOutput(
|
||||
task,
|
||||
code === 0 ? 'success' : 'failure',
|
||||
terminalOutput
|
||||
);
|
||||
}
|
||||
this.writeTerminalOutput(temporaryOutputPath, terminalOutput);
|
||||
});
|
||||
|
||||
|
||||
@ -58,23 +58,22 @@ export function getTuiTerminalSummaryLifeCycle({
|
||||
};
|
||||
|
||||
lifeCycle.printTaskTerminalOutput = (task, taskStatus, terminalOutput) => {
|
||||
taskIdsInOrderOfCompletion.push(task.id);
|
||||
tasksToTerminalOutputs[task.id] = { terminalOutput, taskStatus };
|
||||
};
|
||||
|
||||
lifeCycle.setTaskStatus = (taskId, taskStatus) => {
|
||||
if (taskStatus === NativeTaskStatus.Stopped) {
|
||||
totalStoppedTasks++;
|
||||
taskIdsInOrderOfCompletion.push(taskId);
|
||||
}
|
||||
};
|
||||
|
||||
lifeCycle.endTasks = (taskResults) => {
|
||||
for (let t of taskResults) {
|
||||
for (const { task, status } of taskResults) {
|
||||
totalCompletedTasks++;
|
||||
inProgressTasks.delete(t.task.id);
|
||||
taskIdsInOrderOfCompletion.push(t.task.id);
|
||||
inProgressTasks.delete(task.id);
|
||||
|
||||
switch (t.status) {
|
||||
switch (status) {
|
||||
case 'remote-cache':
|
||||
case 'local-cache':
|
||||
case 'local-cache-kept-existing':
|
||||
@ -86,7 +85,7 @@ export function getTuiTerminalSummaryLifeCycle({
|
||||
break;
|
||||
case 'failure':
|
||||
totalFailedTasks++;
|
||||
failedTasks.add(t.task.id);
|
||||
failedTasks.add(task.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,8 +668,16 @@ export class TaskOrchestrator {
|
||||
// and release the threads
|
||||
await this.scheduleNextTasksAndReleaseThreads();
|
||||
if (this.initializingTaskIds.has(task.id)) {
|
||||
// Hold the thread forever
|
||||
await new Promise(() => {});
|
||||
await new Promise<void>((res) => {
|
||||
runningTask.onExit((code) => {
|
||||
if (!this.tuiEnabled) {
|
||||
if (code > 128) {
|
||||
process.exit(code);
|
||||
}
|
||||
}
|
||||
res();
|
||||
});
|
||||
});
|
||||
}
|
||||
return runningTask;
|
||||
}
|
||||
@ -722,8 +730,16 @@ export class TaskOrchestrator {
|
||||
});
|
||||
await this.scheduleNextTasksAndReleaseThreads();
|
||||
if (this.initializingTaskIds.has(task.id)) {
|
||||
// Hold the thread forever
|
||||
await new Promise(() => {});
|
||||
await new Promise<void>((res) => {
|
||||
childProcess.onExit((code) => {
|
||||
if (!this.tuiEnabled) {
|
||||
if (code > 128) {
|
||||
process.exit(code);
|
||||
}
|
||||
}
|
||||
res();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return childProcess;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user