MCPcopy Create free account
hub / github.com/Noumena-Network/code / resolveShellForLanguage

Function resolveShellForLanguage

src/cli/up.ts:173–193  ·  view source on GitHub ↗
(language: string)

Source from the content-addressed store, hash-verified

171}
172
173function resolveShellForLanguage(language: string): string {
174 const normalized = language.trim().toLowerCase()
175
176 if (normalized === 'fish') {
177 const fish = whichSync('fish')
178 if (!fish) {
179 throw new Error('Found a fish code block, but fish is not installed.')
180 }
181 return fish
182 }
183
184 if (normalized === 'zsh') {
185 const zsh = whichSync('zsh')
186 if (!zsh) {
187 throw new Error('Found a zsh code block, but zsh is not installed.')
188 }
189 return zsh
190 }
191
192 return whichSync('bash') ?? whichSync('sh') ?? process.env.SHELL ?? '/bin/sh'
193}
194
195function getShellArgs(shellPath: string, script: string): string[] {
196 const shellName = parse(shellPath).name.toLowerCase()

Callers 1

runBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected