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; }