crypto/signify: close tmp key file in test (#29444)

This commit is contained in:
guangwu 2024-04-04 18:20:54 +08:00 committed by GitHub
parent 2e0c5e05ba
commit 8bd0334168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -134,6 +134,7 @@ func createKeyPair() (string, string) {
defer os.Remove(tmpKey.Name()) defer os.Remove(tmpKey.Name())
defer os.Remove(tmpKey.Name() + ".pub") defer os.Remove(tmpKey.Name() + ".pub")
defer os.Remove(tmpKey.Name() + ".sec") defer os.Remove(tmpKey.Name() + ".sec")
defer tmpKey.Close()
cmd := exec.Command("signify", "-G", "-n", "-p", tmpKey.Name()+".pub", "-s", tmpKey.Name()+".sec") cmd := exec.Command("signify", "-G", "-n", "-p", tmpKey.Name()+".pub", "-s", tmpKey.Name()+".sec")
if output, err := cmd.CombinedOutput(); err != nil { if output, err := cmd.CombinedOutput(); err != nil {
panic(fmt.Sprintf("could not verify the file: %v, output: \n%s", err, output)) panic(fmt.Sprintf("could not verify the file: %v, output: \n%s", err, output))