mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-15 10:00:28 +00:00
refactor: clean up shell file fetching logic
This commit is contained in:
parent
4c384e4f86
commit
947a26f4df
1 changed files with 6 additions and 7 deletions
|
|
@ -124,13 +124,12 @@ export namespace Shell {
|
|||
return [gitbash(), Bun.which("pwsh"), Bun.which("powershell"), process.env.COMSPEC || "cmd.exe"].filter(
|
||||
Boolean,
|
||||
) as string[]
|
||||
} else {
|
||||
try {
|
||||
const text = await Bun.file("/etc/shells").text()
|
||||
return text.split("\n").filter((line) => line.trim() && !line.startsWith("#"))
|
||||
} catch {
|
||||
return ["/bin/bash", "/bin/zsh", "/bin/sh"]
|
||||
}
|
||||
}
|
||||
const file = Bun.file("/etc/shells")
|
||||
if (await file.exists()) {
|
||||
const text = await file.text()
|
||||
return text.split("\n").filter((line) => line.trim() && !line.startsWith("#"))
|
||||
}
|
||||
return ["/bin/bash", "/bin/zsh", "/bin/sh"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue