fix: quote in execaSudo

This commit is contained in:
Amin Yahyaabadi 2021-12-07 13:37:01 -06:00
parent 52b4862a75
commit 95c8ebb90c
4 changed files with 13 additions and 13 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,28 +35,28 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
case "linux": { case "linux": {
if (arch === "x64") { if (arch === "x64") {
await setupAptPack("gcc", version, [ await setupAptPack("gcc", version, [
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
"ppa:ubuntu-toolchain-r/test", "ppa:ubuntu-toolchain-r/test",
]) ])
binDir = ( binDir = (
await setupAptPack("g++", version, [ await setupAptPack("g++", version, [
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
"ppa:ubuntu-toolchain-r/test", "ppa:ubuntu-toolchain-r/test",
]) ])
).binDir ).binDir
} else { } else {
info(`Install g++-multilib because gcc for ${arch} was requested`) info(`Install g++-multilib because gcc for ${arch} was requested`)
await setupAptPack("gcc-multilib", version, [ await setupAptPack("gcc-multilib", version, [
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
"ppa:ubuntu-toolchain-r/test", "ppa:ubuntu-toolchain-r/test",
]) ])
binDir = ( binDir = (
await setupAptPack("g++-multilib", version, [ await setupAptPack("g++-multilib", version, [
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
"'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'", "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
"ppa:ubuntu-toolchain-r/test", "ppa:ubuntu-toolchain-r/test",
]) ])
).binDir ).binDir
@ -68,8 +68,8 @@ export async function setupGcc(version: string, _setupDir: string, arch: string)
// case "none": { // case "none": {
// if (arch === "arm" || arch === "arm64") { // if (arch === "arm" || arch === "arm64") {
// return setupAptPack("gcc-arm-none-eabi", version, [ // return setupAptPack("gcc-arm-none-eabi", version, [
// "'deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai'", // "deb http://dk.archive.ubuntu.com/ubuntu/ xenial mai",
// "'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'", // "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe",
// "ppa:ubuntu-toolchain-r/test", // "ppa:ubuntu-toolchain-r/test",
// ]) // ])
// } else { // } else {

View File

@ -21,7 +21,7 @@ export function mightSudo(command: string) {
export function execaSudo(file: string, args: string[], cwd?: string) { export function execaSudo(file: string, args: string[], cwd?: string) {
if (isRoot()) { if (isRoot()) {
return execa.command(`sudo ${[file, ...args].join(" ")}`, { shell: true, cwd }) return execa.command(`sudo ${[file, ...args].map((arg) => `'${arg}'`).join(" ")}`, { shell: true, cwd })
} else { } else {
return execa(file, args) return execa(file, args)
} }