( shell: ShellPlan, command: string, env: NodeJS.ProcessEnv = process.env, )
| 155 | } |
| 156 | |
| 157 | export 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 |
no test coverage detected