Skip to content

Commit

Permalink
Revert "Update progress logs on same line"
Browse files Browse the repository at this point in the history
* Not practical

This reverts commit 922597a.

Signed-off-by: xychen <xychen@listenai.com>

# Conflicts:
#	src/utils/cskburn.ts
  • Loading branch information
xychen committed Jun 14, 2024
1 parent 8283e03 commit eaf542a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 2 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ async function fetchInfo(): Promise<void> {
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;
Expand Down Expand Up @@ -249,10 +246,7 @@ async function startFlash(): Promise<void> {
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;
Expand Down
9 changes: 4 additions & 5 deletions src/utils/cskburn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?.();
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit eaf542a

Please sign in to comment.