MCPcopy Create free account
hub / github.com/continuedev/continue / getShellCommand

Function getShellCommand

extensions/cli/src/tools/runTerminalCommand.ts:66–87  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

64
65// Helper function to use login shell on Unix/macOS and PowerShell on Windows and available shell in WSL
66function getShellCommand(command: string): { shell: string; args: string[] } {
67 if (process.platform === "win32") {
68 // Windows: Use PowerShell
69 return {
70 shell: "powershell.exe",
71 args: ["-NoLogo", "-ExecutionPolicy", "Bypass", "-Command", command],
72 };
73 }
74
75 if (isRunningInWsl()) {
76 // in WSL, bash is always available
77 const wslShell = process.env.SHELL || "/bin/bash";
78 return {
79 shell: wslShell,
80 args: ["-l", "-c", command],
81 };
82 }
83
84 // Unix/macOS: Use login shell to source .bashrc/.zshrc etc.
85 const userShell = process.env.SHELL || "/bin/bash";
86 return { shell: userShell, args: ["-l", "-c", command] };
87}
88
89export function runCommandInBackground(command: string): {
90 success: boolean;

Callers 2

runCommandInBackgroundFunction · 0.70

Calls 1

isRunningInWslFunction · 0.85

Tested by

no test coverage detected