Skip to content

Commit ac7fc00

Browse files
output panel buffer corrections
1 parent d567109 commit ac7fc00

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: arduino-ide-extension/src/node/core-service-impl.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
7878
const result = client.compile(compileReq);
7979

8080
const compileBuffer = new OutputPanelBufferProvider(
81-
this.flushOutputPanelMessages,
81+
this.flushOutputPanelMessages.bind(this),
8282
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
8383
);
8484
try {
@@ -185,7 +185,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
185185
const result = responseHandler(client, req);
186186

187187
const uploadBuffer = new OutputPanelBufferProvider(
188-
this.flushOutputPanelMessages,
188+
this.flushOutputPanelMessages.bind(this),
189189
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
190190
);
191191
try {
@@ -256,7 +256,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
256256
const result = client.burnBootloader(burnReq);
257257

258258
const bootloaderBuffer = new OutputPanelBufferProvider(
259-
this.flushOutputPanelMessages,
259+
this.flushOutputPanelMessages.bind(this),
260260
this.FLUSH_OUTPUT_MESSAGES_TIMEOUT_MS
261261
);
262262
try {
@@ -309,8 +309,5 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
309309
this.responseService.appendToOutput({
310310
chunk,
311311
});
312-
this.responseService.appendToOutput({
313-
chunk,
314-
});
315312
}
316313
}

Diff for: arduino-ide-extension/src/node/output-panel-buffer-provider.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ export class OutputPanelBufferProvider {
55

66
constructor(onFlush: (chunk: string) => void, flushTimeout: number) {
77
this.flushInterval = setInterval(() => {
8-
const chunkString = Buffer.concat(this.chunks).toString();
9-
onFlush(chunkString);
10-
this.clearChunks();
8+
if (this.chunks.length > 0) {
9+
const chunkString = Buffer.concat(this.chunks).toString();
10+
this.clearChunks();
11+
12+
onFlush(chunkString);
13+
}
1114
}, flushTimeout);
1215
}
1316

0 commit comments

Comments
 (0)