Support PowerShell and resolve workspaces by directory path

This commit is contained in:
Mohamed Boudra
2026-04-03 14:05:05 +07:00
parent 5d5a79a2a8
commit 449a4b48d2
10 changed files with 323 additions and 17 deletions

View File

@@ -0,0 +1,34 @@
export interface BuildStringCommandShellInvocationOptions {
command: string;
platform?: NodeJS.Platform;
}
export interface StringCommandShellInvocation {
shell: string;
args: string[];
}
export function buildStringCommandShellInvocation(
options: BuildStringCommandShellInvocationOptions,
): StringCommandShellInvocation {
const platform = options.platform ?? process.platform;
if (platform === "win32") {
return {
shell: "powershell",
args: [
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy",
"Bypass",
"-Command",
options.command,
],
};
}
return {
shell: "/bin/bash",
args: ["-lc", options.command],
};
}