Skip to content

Commit 6ab43cf

Browse files
authored
Hotfix (#158)
* hotfix overwrite check * bump version
1 parent fc3d515 commit 6ab43cf

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/golang/glog"
1919
)
2020

21-
const version = "v1.13.0"
21+
const version = "v1.13.1"
2222

2323
func init() {
2424
var versionPrint bool
@@ -80,6 +80,11 @@ func main() {
8080
glog.Exit("Failed to load input file: " + errInp.Error())
8181
}
8282

83+
// Check if the workdir exists and confirm overwrite
84+
if !utils.ConfirmOverwriteIfExists(inp.General.WorkDir, os.Stdin, os.Stdout) {
85+
glog.Exit("terminating...")
86+
}
87+
8388
errExec := inp.ValidateExecutable()
8489
if errExec != nil {
8590
glog.Exit("Failed to validate executable: " + errExec.Error())
@@ -150,11 +155,6 @@ func main() {
150155
glog.Exit("Failed to validate checksum: " + errValidateChecksum.Error())
151156
}
152157

153-
// Check if the workdir exists and confirm overwrite
154-
if !utils.ConfirmOverwriteIfExists(inp.General.WorkDir, os.Stdin, os.Stdout) {
155-
glog.Exit("terminating...")
156-
}
157-
158158
// Organize the dataset
159159
orgData, errOrganize := dataset.OrganizeDataset(inp.General.WorkDir, data)
160160
if errOrganize != nil {
@@ -186,7 +186,7 @@ func main() {
186186
}
187187

188188
if setupOnly {
189-
glog.Exit("Benchmark setup finished successfully, exiting")
189+
glog.Info("Benchmark setup finished successfully, exiting")
190190
os.Exit(0)
191191
}
192192

utils/utils.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,12 @@ func RemoveString(slice []string, s string) []string {
389389

390390
func ConfirmOverwriteIfExists(path string, in io.Reader, out io.Writer) bool {
391391
if _, err := os.Stat(path); !os.IsNotExist(err) {
392+
fmt.Fprint(out, "############################################\n")
393+
fmt.Fprint(out, "############################################\n")
392394
fmt.Fprint(out, "The working directory "+path+" already exists!\n")
393-
fmt.Fprint(out, "Do you want to continue and OVERWRITE the contents? (y/N): ")
395+
fmt.Fprint(out, "If you continue the benchmark will be setup again\n")
396+
fmt.Fprint(out, "This will overwrite any manual changes that you have done to initial data files\n")
397+
fmt.Fprint(out, "Partial results will not affected, do you want to continue? (y/N)")
394398
scanner := bufio.NewScanner(in)
395399
if scanner.Scan() {
396400
answer := scanner.Text()

0 commit comments

Comments
 (0)