本文整理汇总了TypeScript中builder-util/out/util.exec函数的典型用法代码示例。如果您正苦于以下问题:TypeScript exec函数的具体用法?TypeScript exec怎么用?TypeScript exec使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exec函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: sign
export function sign(path: string, name: string, keychain: string): Promise<any> {
const args = ["--deep", "--force", "--sign", name, path]
if (keychain != null) {
args.push("--keychain", keychain)
}
return exec("codesign", args)
}
示例2: importCerts
async function importCerts(keychainName: string, paths: Array<string>, keyPasswords: Array<string>): Promise<CodeSigningInfo> {
for (let i = 0; i < paths.length; i++) {
const password = keyPasswords[i]
await exec("security", ["import", paths[i], "-k", keychainName, "-T", "/usr/bin/codesign", "-T", "/usr/bin/productbuild", "-P", password])
// https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p
// https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996
if (await isMacOsSierra()) {
await exec("security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", password, keychainName])
}
}
return {
keychainName,
}
}
示例3: removeKeychain
async function removeKeychain(keychainFile: string) {
try {
await exec("security", ["delete-keychain", keychainFile])
}
catch (e) {
console.warn(`Cannot delete keychain ${keychainFile}: ${e.stack || e}`)
await unlinkIfExists(keychainFile)
}
}
示例4: listUserKeychains
function listUserKeychains(): Promise<Array<string>> {
return exec("security", ["list-keychains", "-d", "user"])
.then(it => it
.split("\n")
.map(it => {
const r = it.trim()
return r.substring(1, r.length - 1)
})
.filter(it => it.length > 0))
}
示例5: getValidIdentities
async function getValidIdentities(keychain?: string | null): Promise<Array<string>> {
function addKeychain(args: Array<string>) {
if (keychain != null) {
args.push(keychain)
}
return args
}
let result = findIdentityRawResult
if (result == null || keychain != null) {
// https://github.com/electron-userland/electron-builder/issues/481
// https://github.com/electron-userland/electron-builder/issues/535
result = Promise.all<Array<string>>([
exec("security", addKeychain(["find-identity", "-v"]))
.then(it => it.trim().split("\n").filter(it => {
for (const prefix of appleCertificatePrefixes) {
if (it.includes(prefix)) {
return true
}
}
return false
})),
exec("security", addKeychain(["find-identity", "-v", "-p", "codesigning"]))
.then(it => it.trim().split(("\n"))),
])
.then(it => {
const array = it[0].concat(it[1])
.filter(it => !it.includes("(Missing required extension)") && !it.includes("valid identities found") && !it.includes("iPhone ") && !it.includes("com.apple.idms.appleid.prd."))
// remove 1)
.map(it => it.substring(it.indexOf(")") + 1).trim())
return Array.from(new Set(array))
})
if (keychain == null) {
findIdentityRawResult = result
}
}
return result
}
示例6: getCacheDirectory
const bundledCertKeychainAdded = new Lazy<void>(async () => {
// copy to temp and then atomic rename to final path
const cacheDir = getCacheDirectory()
const tmpKeychainPath = path.join(cacheDir, getTempName("electron-builder-root-certs"))
const keychainPath = path.join(cacheDir, "electron-builder-root-certs.keychain")
const results = await Promise.all<any>([
listUserKeychains(),
copyFile(path.join(__dirname, "..", "..", "certs", "root_certs.keychain"), tmpKeychainPath)
.then(() => rename(tmpKeychainPath, keychainPath)),
])
const list = results[0]
if (!list.includes(keychainPath)) {
await exec("security", ["list-keychains", "-d", "user", "-s", keychainPath].concat(list))
}
})
示例7: reportError
export async function reportError(isMas: boolean, certificateType: CertType, qualifier: string | null | undefined, keychainName: string | null | undefined, isForceCodeSigning: boolean) {
const logFields: Fields = {}
if (qualifier == null) {
logFields.reason = ""
if (isAutoDiscoveryCodeSignIdentity()) {
logFields.reason += `cannot find valid "${certificateType}" identity${(isMas ? "" : ` or custom non-Apple code signing certificate`)}`
}
logFields.reason += ", see https://electron.build/code-signing"
if (!isAutoDiscoveryCodeSignIdentity()) {
logFields.CSC_IDENTITY_AUTO_DISCOVERY = false
}
}
else {
logFields.reason = "Identity name is specified, but no valid identity with this name in the keychain"
logFields.identity = qualifier
}
const args = ["find-identity"]
if (keychainName != null) {
args.push(keychainName)
}
if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {
logFields.allIdentities = (await exec("security", args))
.trim()
.split("\n")
.filter(it => !(it.includes("Policy: X.509 Basic") || it.includes("Matching identities")))
.join("\n")
}
if (isMas || isForceCodeSigning) {
throw new Error(Logger.createMessage("skipped macOS application code signing", logFields, "error", it => it))
}
else {
log.warn(logFields, "skipped macOS application code signing")
}
}
示例8: exec
BluebirdPromise.mapSeries(securityCommands, it => exec("security", it))