summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/cli/cmd/run.ts9
-rw-r--r--packages/opencode/src/cli/cmd/tui/thread.ts8
2 files changed, 15 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts
index 61bc609bb..be546beff 100644
--- a/packages/opencode/src/cli/cmd/run.ts
+++ b/packages/opencode/src/cli/cmd/run.ts
@@ -337,7 +337,14 @@ export const RunCommand = cmd({
}
}
- if (!process.stdin.isTTY) message += "\n" + (await Bun.stdin.text())
+ if (!process.stdin.isTTY) {
+ const stdinText = await new Promise<string>((resolve) => {
+ const chunks: Buffer[] = []
+ process.stdin.on("data", (chunk) => chunks.push(chunk))
+ process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")))
+ })
+ message += "\n" + stdinText
+ }
if (message.trim().length === 0 && !args.command) {
UI.error("You must provide a message or a command")
diff --git a/packages/opencode/src/cli/cmd/tui/thread.ts b/packages/opencode/src/cli/cmd/tui/thread.ts
index f53cc3925..cca96dd8c 100644
--- a/packages/opencode/src/cli/cmd/tui/thread.ts
+++ b/packages/opencode/src/cli/cmd/tui/thread.ts
@@ -53,7 +53,13 @@ async function target() {
}
async function input(value?: string) {
- const piped = process.stdin.isTTY ? undefined : await Bun.stdin.text()
+ const piped = process.stdin.isTTY
+ ? undefined
+ : await new Promise<string>((resolve) => {
+ const chunks: Buffer[] = []
+ process.stdin.on("data", (chunk) => chunks.push(chunk))
+ process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")))
+ })
if (!value) return piped
if (!piped) return value
return piped + "\n" + value