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

* Initial plan

* Stop GPG agent before verification home cleanup

Co-authored-by: brunoborges <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: brunoborges <[email protected]>
This commit is contained in:
Copilot
2026-09-28 21:26:40 -04:00
committed by GitHub
co-authored by copilot-swe-agent[bot] <198982749+[email protected]> brunoborges
parent 97c5a5e13a
commit a78ec39f12
6 changed files with 53 additions and 16 deletions
+7 -3
View File
@@ -89,17 +89,20 @@ export async function removeGpgHome(gpgHome: string): Promise<void> {
return;
}
await stopGpgAgent(resolvedGpgHome);
await io.rmRF(resolvedGpgHome);
}
async function stopGpgAgent(gpgHome: string): Promise<void> {
try {
await exec.exec(
'gpgconf',
['--homedir', toGpgPath(resolvedGpgHome), '--kill', 'gpg-agent'],
['--homedir', toGpgPath(gpgHome), '--kill', 'gpg-agent'],
{silent: true, ignoreReturnCode: true}
);
} catch {
// gpgconf may be unavailable, but directory removal must still be attempted.
}
await io.rmRF(resolvedGpgHome);
}
export async function verifyPackageSignature(
@@ -160,6 +163,7 @@ export async function verifyPackageSignature(
options
);
} finally {
await stopGpgAgent(gpgHome);
await io.rmRF(signaturePath);
await io.rmRF(gpgHome);
}