From eaf542a617a2c4e2c1030a17459a24f3fedf4c27 Mon Sep 17 00:00:00 2001 From: xychen Date: Fri, 14 Jun 2024 14:32:20 +0800 Subject: [PATCH] Revert "Update progress logs on same line" * Not practical This reverts commit 922597ac68e2d3b93402bc7cc2ea0cbeeea24109. Signed-off-by: xychen # Conflicts: # src/utils/cskburn.ts --- src/App.vue | 10 ++-------- src/utils/cskburn.ts | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index c3ced63..0c81844 100644 --- a/src/App.vue +++ b/src/App.vue @@ -144,10 +144,7 @@ async function fetchInfo(): Promise { try { result = await busyOn(cskburn(selectedPort.value!, 1500000, [], { onOutput(line) { - if (line.includes('\r')) { - output.value.pop(); - } - output.value.push(line.trim()); + output.value.push(line); }, onChipId(id) { chipId.value = id; @@ -249,10 +246,7 @@ async function startFlash(): Promise { result = await cskburn(selectedPort.value!, 1500000, args, { signal: aborter.signal, onOutput(line) { - if (line.includes('\r')) { - output.value.pop(); - } - output.value.push(line.trim()); + output.value.push(line); }, onChipId(id) { chipId.value = id; diff --git a/src/utils/cskburn.ts b/src/utils/cskburn.ts index 2de184e..8fd526a 100644 --- a/src/utils/cskburn.ts +++ b/src/utils/cskburn.ts @@ -46,7 +46,6 @@ export async function cskburn( function handleOutput(output: string) { opts?.onOutput?.(output); - output = output.trim(); let match: RegExpMatchArray | null = null; if (output == 'Waiting for device...') { opts?.onWaitingForDevice?.(); @@ -78,14 +77,14 @@ export async function cskburn( command.stdout.on('data', async (data: Uint8Array) => { const line = await decode(data); - outputs.push(line.trim()); - handleOutput(line); + outputs.push(line); + handleOutput(line.trim()); }); command.stderr.on('data', async (data: Uint8Array) => { const line = await decode(data); - outputs.push(line.trim()); - handleOutput(line); + outputs.push(line); + handleOutput(line.trim()); }); command.once('close', (data) => {