From c76209b081774ede6a4a48d105e6038f57456236 Mon Sep 17 00:00:00 2001 From: Elias Skogevall Date: Fri, 30 Jul 2021 15:06:02 +0200 Subject: [PATCH] Fix fallback for not unstable runtime --- mod.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mod.ts b/mod.ts index ff75ddc..666f183 100644 --- a/mod.ts +++ b/mod.ts @@ -205,7 +205,14 @@ export class Spinner { } updateLines(): void { - const columns = Deno.consoleSize(this.#stream.rid)?.columns || 80; + let columns = 80; + + try { + columns = Deno.consoleSize(this.#stream.rid)?.columns ?? columns; + } catch { + // Unstable APIs is not enabled, fallback to default + } + const fullPrefixText = typeof this.prefix === "string" ? this.prefix + "-" : "";