Stop GPG agent before removing signature-verification home (#1273)

* Initial plan

* Stop GPG agent before verification home cleanup

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
This commit is contained in:
Copilot
2026-09-28 21:26:40 -04:00
committed by GitHub
parent 97c5a5e13a
commit a78ec39f12
6 changed files with 53 additions and 16 deletions
+6 -2
View File
@@ -35832,13 +35832,16 @@ async function removeGpgHome(gpgHome) {
if (!external_fs_.existsSync(resolvedGpgHome)) {
return;
}
await stopGpgAgent(resolvedGpgHome);
await lib_io/* rmRF */.Yz(resolvedGpgHome);
}
async function stopGpgAgent(gpgHome) {
try {
await lib_exec/* exec */.m('gpgconf', ['--homedir', toGpgPath(resolvedGpgHome), '--kill', 'gpg-agent'], { silent: true, ignoreReturnCode: true });
await lib_exec/* exec */.m('gpgconf', ['--homedir', toGpgPath(gpgHome), '--kill', 'gpg-agent'], { silent: true, ignoreReturnCode: true });
}
catch {
// gpgconf may be unavailable, but directory removal must still be attempted.
}
await lib_io/* rmRF */.Yz(resolvedGpgHome);
}
async function verifyPackageSignature(archivePath, signatureUrl, publicKeyContent) {
const signaturePath = await tc.downloadTool(signatureUrl);
@@ -35884,6 +35887,7 @@ async function verifyPackageSignature(archivePath, signatureUrl, publicKeyConten
], options);
}
finally {
await stopGpgAgent(gpgHome);
await io.rmRF(signaturePath);
await io.rmRF(gpgHome);
}