Skip to content

Commit

Permalink
Ensure install progress msg stays in one line (#12165)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Nov 24, 2022
1 parent cda5378 commit 9b75af3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/kernels/installer/moduleInstaller.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ export abstract class ModuleInstaller implements IModuleInstaller {
});
}
let lastStdErr: string | undefined;
const ticker = ['', '.', '..', '...'];
let counter = 0;
if (observable) {
observable.out.subscribe({
next: (output) => {
const suffix = ticker[counter % 4];
const trimmedOutput = output.out.trim();
counter += 1;
const message =
output.out.length > 100
? `${output.out.substring(0, 50)}...${output.out.substring(output.out.length - 50)}`
: output.out;
trimmedOutput.length > 30 ? `${trimmedOutput.substring(0, 30)}${suffix}` : trimmedOutput;
progress.report({ message });
traceInfo(output.out);
if (output.source === 'stderr') {
Expand Down

0 comments on commit 9b75af3

Please sign in to comment.