mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Support PowerShell and resolve workspaces by directory path
This commit is contained in:
34
packages/server/src/utils/string-command-shell.ts
Normal file
34
packages/server/src/utils/string-command-shell.ts
Normal 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],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user