Skip to content

Commit c333ffa

Browse files
committed
core: fix LSP server binary installation and shell command execution
- Ensure proper file permissions are set for installed LSP binaries on non-Windows platforms - Add error handling for shell command execution in prompt system to prevent crashes
1 parent 3456f4e commit c333ffa

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎packages/opencode/src/lsp/server.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ export namespace LSPServer {
697697
})
698698
if (!ok) return
699699
} else {
700-
await $`tar -xf ${tempPath}`.cwd(Global.Path.bin).nothrow()
700+
await $`tar -xf ${tempPath}`.cwd(Global.Path.bin).quiet().nothrow()
701701
}
702702

703703
await fs.rm(tempPath, { force: true })
@@ -710,7 +710,7 @@ export namespace LSPServer {
710710
}
711711

712712
if (platform !== "win32") {
713-
await $`chmod +x ${bin}`.nothrow()
713+
await $`chmod +x ${bin}`.quiet().nothrow()
714714
}
715715

716716
log.info(`installed zls`, { bin })
@@ -1003,7 +1003,7 @@ export namespace LSPServer {
10031003
if (!ok) return
10041004
}
10051005
if (tar) {
1006-
await $`tar -xf ${archive}`.cwd(Global.Path.bin).nothrow()
1006+
await $`tar -xf ${archive}`.cwd(Global.Path.bin).quiet().nothrow()
10071007
}
10081008
await fs.rm(archive, { force: true })
10091009

@@ -1014,7 +1014,7 @@ export namespace LSPServer {
10141014
}
10151015

10161016
if (platform !== "win32") {
1017-
await $`chmod +x ${bin}`.nothrow()
1017+
await $`chmod +x ${bin}`.quiet().nothrow()
10181018
}
10191019

10201020
await fs.unlink(path.join(Global.Path.bin, "clangd")).catch(() => {})
@@ -1580,7 +1580,7 @@ export namespace LSPServer {
15801580
}
15811581

15821582
if (platform !== "win32") {
1583-
await $`chmod +x ${bin}`.nothrow()
1583+
await $`chmod +x ${bin}`.quiet().nothrow()
15841584
}
15851585

15861586
log.info(`installed terraform-ls`, { bin })
@@ -1663,7 +1663,7 @@ export namespace LSPServer {
16631663
if (!ok) return
16641664
}
16651665
if (ext === "tar.gz") {
1666-
await $`tar -xzf ${tempPath}`.cwd(Global.Path.bin).nothrow()
1666+
await $`tar -xzf ${tempPath}`.cwd(Global.Path.bin).quiet().nothrow()
16671667
}
16681668

16691669
await fs.rm(tempPath, { force: true })
@@ -1676,7 +1676,7 @@ export namespace LSPServer {
16761676
}
16771677

16781678
if (platform !== "win32") {
1679-
await $`chmod +x ${bin}`.nothrow()
1679+
await $`chmod +x ${bin}`.quiet().nothrow()
16801680
}
16811681

16821682
log.info("installed texlab", { bin })

‎packages/opencode/src/session/prompt.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ export namespace SessionPrompt {
13091309
const results = await Promise.all(
13101310
shell.map(async ([, cmd]) => {
13111311
try {
1312-
return await $`${{ raw: cmd }}`.nothrow().text()
1312+
return await $`${{ raw: cmd }}`.quiet().nothrow().text()
13131313
} catch (error) {
13141314
return `Error executing command: ${error instanceof Error ? error.message : String(error)}`
13151315
}

0 commit comments

Comments
 (0)