Ensure File Does Not Exist (#12536)

* error out

* gaz

---------

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
Nishant Das
2023-06-16 05:41:46 +08:00
committed by GitHub
parent 996ec67229
commit 194b3b1c5e
4 changed files with 9 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ go_library(
importpath = "github.com/prysmaticlabs/prysm/v4/tools/interop/convert-keys",
visibility = ["//visibility:public"],
deps = [
"//config/params:go_default_library",
"//tools/unencrypted-keys-gen/keygen:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@in_gopkg_yaml_v2//:go_default_library",

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"os"
"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/tools/unencrypted-keys-gen/keygen"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
@@ -52,7 +53,7 @@ func main() {
})
}
outFile, err := os.Create(os.Args[2])
outFile, err := os.OpenFile(os.Args[2], os.O_CREATE|os.O_EXCL, params.BeaconIoConfig().ReadWritePermissions)
if err != nil {
log.WithError(err).Fatalf("Failed to create file at %s", os.Args[2])
}