Explorar o código

Merge pull request #5110 from gyuho/error_when_db_not_exist

etcdctl: snapshot status error for non-existent file
Gyu-Ho Lee %!s(int64=10) %!d(string=hai) anos
pai
achega
caf0e9b9b1
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      etcdctl/ctlv3/command/snapshot_command.go

+ 4 - 0
etcdctl/ctlv3/command/snapshot_command.go

@@ -297,6 +297,10 @@ type dbstatus struct {
 }
 
 func dbStatus(p string) dbstatus {
+	if _, err := os.Stat(p); err != nil {
+		ExitWithError(ExitError, err)
+	}
+
 	ds := dbstatus{}
 
 	db, err := bolt.Open(p, 0600, nil)