From 34366a56fcc82db95ff6e074b6950f1e476544ba Mon Sep 17 00:00:00 2001 From: cseidr Date: Thu, 25 Jan 2024 21:00:07 +0100 Subject: [PATCH 1/2] fixed warnings for deprecated functions in console/utils.ts --- src/console/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/console/utils.ts b/src/console/utils.ts index 8965d2c..9c81f2b 100644 --- a/src/console/utils.ts +++ b/src/console/utils.ts @@ -18,7 +18,7 @@ export async function* readKeys() { const { strip_ansi_codes } = wasmInstance; while (true) { const buf = new Uint8Array(8); - const byteCount = await Deno.read(Deno.stdin.rid, buf); + const byteCount = await Deno.stdin.read(buf);; if (byteCount == null) { break; } @@ -68,7 +68,7 @@ export function showCursor() { Deno.stderr.writeSync(encoder.encode("\x1B[?25h")); } -export const isOutputTty = safeConsoleSize() != null && Deno.isatty(Deno.stderr.rid); +export const isOutputTty = safeConsoleSize() != null && Deno.stderr.isTerminal(); export function resultOrExit(result: T | undefined): T { if (result == null) { @@ -86,7 +86,7 @@ export interface SelectionOptions { } export function createSelection(options: SelectionOptions): Promise { - if (!isOutputTty || !Deno.isatty(Deno.stdin.rid)) { + if (!isOutputTty || !Deno.stdin.isTerminal()) { throw new Error(`Cannot prompt when not a tty. (Prompt: '${options.message}')`); } if (safeConsoleSize() == null) { From a97a32c23f2b311087569240b382983f3d9500eb Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 25 Jan 2024 16:16:57 -0500 Subject: [PATCH 2/2] Format --- src/console/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console/utils.ts b/src/console/utils.ts index 9c81f2b..ac30551 100644 --- a/src/console/utils.ts +++ b/src/console/utils.ts @@ -18,7 +18,7 @@ export async function* readKeys() { const { strip_ansi_codes } = wasmInstance; while (true) { const buf = new Uint8Array(8); - const byteCount = await Deno.stdin.read(buf);; + const byteCount = await Deno.stdin.read(buf); if (byteCount == null) { break; }