mirror of https://github.com/aminya/setup-cpp
fix: set shell: true for execRoot
This commit is contained in:
parent
88c2d1ac03
commit
f8515dfc8b
|
@ -24,13 +24,13 @@ export function prependSudo(command: string) {
|
|||
*
|
||||
* @param program The program to spawn
|
||||
* @param args The command arguments
|
||||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit" }`
|
||||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit", shell: true }`
|
||||
* @returns The execution result
|
||||
*/
|
||||
export function execRootSync(
|
||||
program: string,
|
||||
args: string[] = [],
|
||||
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
||||
execOptions: execa.SyncOptions = { stdio: "inherit", shell: true }
|
||||
): execa.ExecaSyncReturnValue<string> {
|
||||
if (isSudo()) {
|
||||
return execa.commandSync(`sudo ${[program, ...args].map((arg) => `'${arg}'`).join(" ")}`, execOptions)
|
||||
|
@ -44,13 +44,13 @@ export function execRootSync(
|
|||
*
|
||||
* @param program The program to spawn
|
||||
* @param args The command arguments
|
||||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit" }`
|
||||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit", shell: true }`
|
||||
* @returns A promise to the execution result
|
||||
*/
|
||||
export function execRoot(
|
||||
program: string,
|
||||
args: string[] = [],
|
||||
execOptions: execa.Options = { stdio: "inherit" }
|
||||
execOptions: execa.Options = { stdio: "inherit", shell: true }
|
||||
): execa.ExecaChildProcess<string> {
|
||||
if (isSudo()) {
|
||||
return execa.command(`sudo ${[program, ...args].map((arg) => `'${arg}'`).join(" ")}`, execOptions)
|
||||
|
|
|
@ -8,6 +8,6 @@ export function folderUserAccess(folder: string) {
|
|||
isSudo() &&
|
||||
process.env.SUDO_USER !== undefined
|
||||
) {
|
||||
execRootSync("chown", ["-R", process.env.SUDO_USER, folder], { cwd: folder, stdio: "inherit" })
|
||||
execRootSync("chown", ["-R", process.env.SUDO_USER, folder], { cwd: folder, stdio: "inherit", shell: true })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue