mirror of https://github.com/aminya/setup-cpp
feat: add sync execPowershell
This commit is contained in:
parent
897c5f67c8
commit
92711bc219
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -24,6 +24,26 @@ export function execPowershell(
|
|||
return execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a powershell command.
|
||||
*
|
||||
* @param command The powershell command to execute
|
||||
* @param startupFlags The optional startup flags to be passed to powershell.
|
||||
*
|
||||
* Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first.
|
||||
* @param execOptions The options passed to `execa`.
|
||||
*
|
||||
* Defaults to `{ stdio: "inherit" }`
|
||||
* @note It prefers `pwsh` over `powershell`
|
||||
*/
|
||||
export function execPowershellSync(
|
||||
command: string,
|
||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
||||
) {
|
||||
return execa.sync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the powershell executable.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue