git-for-windows / git-for-windows-automation

A few GitHub workflows and support code to help with Git for Windows' day-to-day tasks
10 stars 9 forks source link

In the "Clean up temporary files" step, stop gnupg before deleting its home directory #64

Open dscho opened 4 months ago

dscho commented 4 months ago

GNU Privacy Guard starts a gpg-agent that may very well access the keys in its home directory. Therefore, when we try to clean them up, that agent may still be running and the files cannot be deleted. This is exactly what happened yesterday when deploying libfido2:

▸Run rm -rf "$HOME"
rm: cannot remove '/d/a/_temp/home/.gnupg/public-keys.d/pubring.db': Device or resource busy
Error: Process completed with exit code 1.

Let's specifically stop the gpg-agent before removing the home directory to work around this issue.