Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
output panel buffer corrections
  • Loading branch information
davegarthsimpson committed Jun 13, 2022
commit ac7fc000432bea25f88cda3cc2b03ec6bc8ba4b9
9 changes: 3 additions & 6 deletions arduino-ide-extension/src/node/core-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
const result = client.compile(compileReq);

const compileBuffer = new OutputPanelBufferProvider(
this.flushOutputPanelMessages,
this.flushOutputPanelMessages.bind(this),
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
);
try {
Expand Down Expand Up @@ -185,7 +185,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
const result = responseHandler(client, req);

const uploadBuffer = new OutputPanelBufferProvider(
this.flushOutputPanelMessages,
this.flushOutputPanelMessages.bind(this),
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
);
try {
Expand Down Expand Up @@ -256,7 +256,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
const result = client.burnBootloader(burnReq);

const bootloaderBuffer = new OutputPanelBufferProvider(
this.flushOutputPanelMessages,
this.flushOutputPanelMessages.bind(this),
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
);
try {
Expand Down Expand Up @@ -309,8 +309,5 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
this.responseService.appendToOutput({
chunk,
});
this.responseService.appendToOutput({
chunk,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ export class OutputPanelBufferProvider {

constructor(onFlush: (chunk: string) => void, flushTimeout: number) {
this.flushInterval = setInterval(() => {
const chunkString = Buffer.concat(this.chunks).toString();
onFlush(chunkString);
this.clearChunks();
if (this.chunks.length > 0) {
const chunkString = Buffer.concat(this.chunks).toString();
this.clearChunks();

onFlush(chunkString);
}
}, flushTimeout);
}

Expand Down