From abe6efae40bdc5bab2a932a1bfa510713d5d5f9c Mon Sep 17 00:00:00 2001 From: ps-kwang <135043922+ps-kwang@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:16:18 -0400 Subject: [PATCH] fix: use stderr for loading (#69) Closes https://github.com/Paperspace/cli/issues/53 --- lib/loading.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/loading.ts b/lib/loading.ts index be1a668..e3f02ae 100644 --- a/lib/loading.ts +++ b/lib/loading.ts @@ -29,13 +29,13 @@ export async function loading>( } async function spin() { - await write(cursorHide()); + await write(cursorHide(), Deno.stderr); while (spinning) { - await writeLn(frames[i++ % frames.length] + " " + text); + await writeLn(frames[i++ % frames.length] + " " + text, Deno.stderr); await new Promise((resolve) => setTimeout(async () => { - await write(cursorUp(1) + eraseDown()); + await write(cursorUp(1) + eraseDown(), Deno.stderr); resolve(); }, 100) ); @@ -47,13 +47,13 @@ export async function loading>( spinning = false; return value; }).catch(async (error) => { - await write(cursorUp(1) + eraseDown() + cursorShow()); + await write(cursorUp(1) + eraseDown() + cursorShow(), Deno.stderr); throw error; }), spin(), ]); - await write(cursorShow()); + await write(cursorShow(), Deno.stderr); return value; }