mirror of https://github.com/aminya/setup-cpp
fix: escape regex of the name-version apt package
This commit is contained in:
parent
dac72316df
commit
5505d67258
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -59,6 +59,7 @@
|
|||
"ci-log": "workspace:1.0.0",
|
||||
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
|
||||
"escape-quotes": "^1.0.2",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"exec-powershell": "workspace:1.0.0",
|
||||
"execa": "^5.1.1",
|
||||
"is-url-online": "^1.5.0",
|
||||
|
|
|
@ -31,6 +31,7 @@ importers:
|
|||
cspell: ^6.14.3
|
||||
escape-path-with-spaces: github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3
|
||||
escape-quotes: ^1.0.2
|
||||
escape-string-regexp: ^5.0.0
|
||||
eslint: ^8.28.0
|
||||
eslint-config-atomic: ^1.18.1
|
||||
exec-powershell: workspace:1.0.0
|
||||
|
@ -73,6 +74,7 @@ importers:
|
|||
ci-log: link:packages/ci-log
|
||||
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
|
||||
escape-quotes: 1.0.2
|
||||
escape-string-regexp: 5.0.0
|
||||
exec-powershell: link:packages/exec-powershell
|
||||
execa: 5.1.1
|
||||
is-url-online: 1.5.0
|
||||
|
|
|
@ -9,6 +9,7 @@ import pathExists from "path-exists"
|
|||
import { promises as fsPromises } from "fs"
|
||||
const { appendFile } = fsPromises
|
||||
import execa from "execa"
|
||||
import escapeRegex from "escape-string-regexp"
|
||||
|
||||
let didUpdate: boolean = false
|
||||
let didInit: boolean = false
|
||||
|
@ -58,7 +59,12 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
|
|||
|
||||
async function getAptArg(name: string, version: string | undefined) {
|
||||
if (version !== undefined && version !== "") {
|
||||
const { stdout } = await execa("apt-cache", ["search", "--names-only", `^${name}-${version}$`])
|
||||
console.log(`^${escapeRegex(`${name}-${version}`)}$`)
|
||||
const { stdout } = await execa("apt-cache", [
|
||||
"search",
|
||||
"--names-only",
|
||||
`^${escapeRegex(name)}\-${escapeRegex(version)}$`,
|
||||
])
|
||||
if (stdout.trim() !== "") {
|
||||
return `${name}-${version}`
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue