Skip to content

Commit abe6efa

Browse files
authored
fix: use stderr for loading (#69)
Closes #53
1 parent 0befc5d commit abe6efa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/loading.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ export async function loading<Promised extends Promise<any>>(
2929
}
3030

3131
async function spin() {
32-
await write(cursorHide());
32+
await write(cursorHide(), Deno.stderr);
3333

3434
while (spinning) {
35-
await writeLn(frames[i++ % frames.length] + " " + text);
35+
await writeLn(frames[i++ % frames.length] + " " + text, Deno.stderr);
3636
await new Promise<void>((resolve) =>
3737
setTimeout(async () => {
38-
await write(cursorUp(1) + eraseDown());
38+
await write(cursorUp(1) + eraseDown(), Deno.stderr);
3939
resolve();
4040
}, 100)
4141
);
@@ -47,13 +47,13 @@ export async function loading<Promised extends Promise<any>>(
4747
spinning = false;
4848
return value;
4949
}).catch(async (error) => {
50-
await write(cursorUp(1) + eraseDown() + cursorShow());
50+
await write(cursorUp(1) + eraseDown() + cursorShow(), Deno.stderr);
5151
throw error;
5252
}),
5353
spin(),
5454
]);
5555

56-
await write(cursorShow());
56+
await write(cursorShow(), Deno.stderr);
5757
return value;
5858
}
5959

0 commit comments

Comments
 (0)