File: gpg_agent.go

package info (click to toggle)
golang-github-containers-image 5.28.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,104 kB
  • sloc: sh: 194; makefile: 73
file content (14 lines) | stat: -rw-r--r-- 405 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package gpgagent

import (
	"os"
	"os/exec"
)

// Kill the running gpg-agent to drop unlocked keys.
// This is useful to ensure tests don’t leave processes around (in TestMain), or for testing handling of invalid passphrases.
func KillGPGAgent(gpgHomeDir string) error {
	cmd := exec.Command("gpgconf", "--kill", "gpg-agent")
	cmd.Env = append(os.Environ(), "GNUPGHOME="+gpgHomeDir)
	return cmd.Run()
}