8000 #608, #229 Reveal the error location after the failed verify by kittaakos · Pull Request #1064 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

#608, #229 Reveal the error location after the failed verify #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

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
Merged in #1074.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Jun 21, 2022
commit e7ee86197dc0d06758990e52798ff087aac7fdf2
23 changes: 11 additions & 12 deletions arduino-ide-extension/src/node/utils/simple-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ import { OutputMessage } from '../../common/protocol';
const DEFAULT_FLUS_TIMEOUT_MS = 32;

export class SimpleBuffer implements Disposable {
private readonly flush: () => void;
private readonly chunks = Chunks.create();
private readonly flush: () => void;
private flushInterval?: NodeJS.Timeout;

constructor(onFlush: (chunk: string) => void, flushTimeout: number) {
const flush = () => {
if (this.chunks.length > 0) {
const chunkString = Buffer.concat(this.chunks).toString();
constructor(
onFlush: (chunks: Map<OutputMessage.Severity, string | undefined>) => void,
flushTimeout: number = DEFAULT_FLUS_TIMEOUT_MS
) {
this.flush = () => {
if (!Chunks.isEmpty(this.chunks)) {
const chunks = Chunks.toString(this.chunks);
this.clearChunks();
onFlush(chunks);
}
};

this.flush = flush;
this.flushInterval = setInterval(flush, flushTimeout);
this.flushInterval = setInterval(this.flush, flushTimeout);
}

public addChunk(
addChunk(
chunk: Uint8Array,
severity: OutputMessage.Severity = OutputMessage.Severity.Info
): void {
Expand All @@ -32,10 +33,8 @@ export class SimpleBuffer implements Disposable {
Chunks.clear(this.chunks);
}

public clearFlushInterval(): void {
dispose(): void {
this.flush();
this.clearChunks();

clearInterval(this.flushInterval);
this.clearChunks();
this.flushInterval = undefined;
Expand Down
0