Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 1bc3c98

Browse files
committed
ensure wl-copy is available
1 parent 55787f2 commit 1bc3c98

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/opencode/src/cli/cmd/tui/util/clipboard.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export namespace Clipboard {
6161
const getCopyMethod = lazy(() => {
6262
const os = platform()
6363

64-
if (os === "darwin") {
64+
if (os === "darwin" && Bun.which("oascript")) {
6565
console.log("clipboard: using osascript")
6666
return async (text: string) => {
6767
const escaped = text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
@@ -70,13 +70,13 @@ export namespace Clipboard {
7070
}
7171

7272
if (os === "linux") {
73-
if (process.env["WAYLAND_DISPLAY"]) {
73+
if (process.env["WAYLAND_DISPLAY"] && Bun.which("wl-copy")) {
7474
console.log("clipboard: using wl-copy")
7575
return async (text: string) => {
7676
const proc = Bun.spawn(["wl-copy"], { stdin: "pipe", stdout: "ignore", stderr: "ignore" })
7777
proc.stdin.write(text)
7878
proc.stdin.end()
79-
await proc.exited
79+
await proc.exited.catch(() => {})
8080
}
8181
}
8282
if (Bun.which("xclip")) {
@@ -117,7 +117,7 @@ export namespace Clipboard {
117117

118118
console.log("clipboard: no native support")
119119
return async (text: string) => {
120-
await clipboardy.write(text)
120+
await clipboardy.write(text).catch(() => {})
121121
}
122122
})
123123

0 commit comments

Comments
 (0)