MCPcopy Create free account
hub / github.com/apache/maka / buildPtyShellSpawnPlan

Function buildPtyShellSpawnPlan

packages/runtime/src/shell-detect.ts:157–177  ·  view source on GitHub ↗
(
  shell: ShellPlan,
  command: string,
  env: NodeJS.ProcessEnv = process.env,
)

Source from the content-addressed store, hash-verified

155}
156
157export function buildPtyShellSpawnPlan(
158 shell: ShellPlan,
159 command: string,
160 env: NodeJS.ProcessEnv = process.env,
161): PtyShellSpawnPlan {
162 if ((shell.kind === 'pwsh' || shell.kind === 'powershell') && shell.exe) {
163 const wrapped = buildPowerShellCommand(command, env);
164 return {
165 file: shell.exe,
166 args: ['-NoLogo', '-NoProfile', '-Command', wrapped.script],
167 env: wrapped.env,
168 };
169 }
170 if (shell.kind === 'cmd') {
171 return {
172 file: env.ComSpec || env.COMSPEC || 'cmd.exe',
173 args: ['/d', '/s', '/c', command],
174 };
175 }
176 return { file: '/bin/sh', args: ['-c', command] };
177}
178
179/**
180 * Shell-dialect sentence for Bash tool descriptions. Empty on POSIX (the

Callers 2

startPtyMethod · 0.85

Calls 1

buildPowerShellCommandFunction · 0.85

Tested by

no test coverage detected