summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-08-15 06:11:09 -0500
committerGitHub <[email protected]>2025-08-15 06:11:09 -0500
commit62fed8d2ce3070f7e346752017f3d7d5167b1a4e (patch)
tree2de17a3cb24c517de8dbbccbd738632b44a253b5
parent6fbe28619cd0b67d5d00ddf4acff2865805adb47 (diff)
downloadopencode-62fed8d2ce3070f7e346752017f3d7d5167b1a4e.tar.gz
opencode-62fed8d2ce3070f7e346752017f3d7d5167b1a4e.zip
fix: fish shell (#1950)
-rw-r--r--packages/opencode/src/session/index.ts22
1 files changed, 15 insertions, 7 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 222cf8257..741f965f9 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -1056,14 +1056,22 @@ export namespace Session {
}
await updatePart(part)
const app = App.info()
- const script = `
- [[ -f ~/.zshrc ]] && source ~/.zshrc >/dev/null 2>&1 || true
- [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
- eval "${input.command}"
- `
const shell = process.env["SHELL"] ?? "bash"
- const supportsLoginFlag = !shell.includes("fish") && !shell.includes("nu")
- const args = supportsLoginFlag ? ["-c", "-l", script] : ["-c", script]
+ const shellName = path.basename(shell)
+
+ const scripts: Record<string, string> = {
+ nu: input.command,
+ fish: `eval "${input.command}"`,
+ }
+
+ const script =
+ scripts[shellName] ??
+ `[[ -f ~/.zshrc ]] && source ~/.zshrc >/dev/null 2>&1 || true
+ [[ -f ~/.bashrc ]] && source ~/.bashrc >/dev/null 2>&1 || true
+ eval "${input.command}"`
+
+ const isFishOrNu = shellName === "fish" || shellName === "nu"
+ const args = isFishOrNu ? ["-c", script] : ["-c", "-l", script]
const proc = spawn(shell, args, {
cwd: app.path.cwd,