fix: restore Bun stdin reads for prompt input (#16300)

This commit is contained in:
Dax 2026-03-06 02:08:10 -05:00 committed by GitHub
parent aec6ca71fa
commit 326c70184d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import { cmd } from "./cmd"
import { Flag } from "../../flag/flag" import { Flag } from "../../flag/flag"
import { bootstrap } from "../bootstrap" import { bootstrap } from "../bootstrap"
import { EOL } from "os" import { EOL } from "os"
import { text as streamText } from "node:stream/consumers"
import { Filesystem } from "../../util/filesystem" import { Filesystem } from "../../util/filesystem"
import { createOpencodeClient, type Message, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2" import { createOpencodeClient, type Message, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2"
import { Server } from "../../server/server" import { Server } from "../../server/server"
@ -338,7 +337,7 @@ export const RunCommand = cmd({
} }
} }
if (!process.stdin.isTTY) message += "\n" + (await streamText(process.stdin)) if (!process.stdin.isTTY) message += "\n" + (await Bun.stdin.text())
if (message.trim().length === 0 && !args.command) { if (message.trim().length === 0 && !args.command) {
UI.error("You must provide a message or a command") UI.error("You must provide a message or a command")

View File

@ -3,7 +3,6 @@ import { tui } from "./app"
import { Rpc } from "@/util/rpc" import { Rpc } from "@/util/rpc"
import { type rpc } from "./worker" import { type rpc } from "./worker"
import path from "path" import path from "path"
import { text as streamText } from "node:stream/consumers"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { UI } from "@/cli/ui" import { UI } from "@/cli/ui"
import { Log } from "@/util/log" import { Log } from "@/util/log"
@ -54,7 +53,7 @@ async function target() {
} }
async function input(value?: string) { async function input(value?: string) {
const piped = process.stdin.isTTY ? undefined : await streamText(process.stdin) const piped = process.stdin.isTTY ? undefined : await Bun.stdin.text()
if (!value) return piped if (!value) return piped
if (!piped) return value if (!piped) return value
return piped + "\n" + value return piped + "\n" + value