MCPcopy Index your code
hub / github.com/Waishnav/devspace / resolveShellCommand

Function resolveShellCommand

src/process-platform.ts:35–57  ·  view source on GitHub ↗
(
  command: string,
  platform: NodeJS.Platform = process.platform,
  environment: NodeJS.ProcessEnv = process.env,
)

Source from the content-addressed store, hash-verified

33const POSIX_SHELLS = new Set(["ash", "dash", "sh"]);
34
35export function resolveShellCommand(
36 command: string,
37 platform: NodeJS.Platform = process.platform,
38 environment: NodeJS.ProcessEnv = process.env,
39): ShellCommand {
40 if (platform === "win32") {
41 return {
42 executable: environment.ComSpec ?? environment.COMSPEC ?? "cmd.exe",
43 args: ["/d", "/s", "/c", command],
44 };
45 }
46
47 const configuredShell = environment.SHELL;
48 const shellName = configuredShell ? basename(configuredShell) : "";
49 if (configuredShell && LOGIN_SHELLS.has(shellName)) {
50 return { executable: configuredShell, args: ["-lc", command] };
51 }
52 if (configuredShell && POSIX_SHELLS.has(shellName)) {
53 return { executable: configuredShell, args: ["-c", command] };
54 }
55
56 return { executable: "/bin/sh", args: ["-c", command] };
57}
58
59export function terminateProcessTree(
60 child: KillableProcess,

Callers 3

startPipeMethod · 0.85
startPtyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected