@@ -1,4 +1,5 @@
11 import * as c from "yoctocolors";
2+import { terminal } from "./terminal-io.ts";
23
34 export const SPINNER_FRAMES = ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"];
45
@@ -8,10 +9,10 @@ export class Spinner {
89 private label = "";
910
1011 start(label = ""): void {
11- if (!process.stderr.isTTY) return;
12+ if (!terminal.isStderrTTY) return;
1213 this.label = label;
1314 if (this.timer) return;
14- process.stderr.write("\x1B[?25l");
15+ terminal.stderrWrite("\x1B[?25l");
1516 this._tick();
1617 this.timer = setInterval(() => this._tick(), 80);
1718 }
@@ -20,7 +21,7 @@ export class Spinner {
2021 if (!this.timer) return;
2122 clearInterval(this.timer);
2223 this.timer = null;
23- process.stderr.write("\r\x1B[2K\x1B[?25h");
24+ terminal.stderrWrite("\r\x1B[2K\x1B[?25h");
2425 }
2526
2627 update(label: string): void {
@@ -30,6 +31,6 @@ export class Spinner {
3031 private _tick(): void {
3132 const f = SPINNER_FRAMES[this.frame++ % SPINNER_FRAMES.length] ?? "⣾";
3233 const label = this.label ? c.dim(` ${this.label}`) : "";
33- process.stderr.write(`\r${c.dim(f)}${label}`);
34+ terminal.stderrWrite(`\r${c.dim(f)}${label}`);
3435 }
3536 }