diff --git a/src/bun/terminal_io.ts b/src/bun/terminal_io.ts index 18dfbe8..b7971af 100644 --- a/src/bun/terminal_io.ts +++ b/src/bun/terminal_io.ts @@ -7,6 +7,8 @@ import { defaultTerminalSize } from '../common/config.ts'; import { readKey } from '../common/fns.ts'; import { ITerminal, ITerminalSize } from '../common/types.ts'; +const encoder = new TextEncoder(); + async function _getTerminalSizeFromAnsi(): Promise { // Tell the cursor to move to Row 999 and Column 999 // Since this command specifically doesn't go off the screen @@ -46,8 +48,13 @@ const BunTerminalIO: ITerminal = { // to have consistent argument lists argv: (Bun.argv.length > 2) ? Bun.argv.slice(2) : [], inputLoop: async function* inputLoop() { - for await (const chunk of Bun.stdin.stream()) { - yield chunk; + // for await (const chunk of Bun.stdin.stream()) { + // yield chunk; + // } + // + // return null; + for await (const chunk of process.stdin) { + yield encoder.encode(chunk); } return null; @@ -73,7 +80,7 @@ const BunTerminalIO: ITerminal = { return chunk.value ?? null; }, writeStdout: async function write(s: string): Promise { - const buffer = new TextEncoder().encode(s); + const buffer = encoder.encode(s); await Bun.write(Bun.stdout, buffer); },