summaryrefslogtreecommitdiffstats
path: root/cmd/dump.go
diff options
context:
space:
mode:
authorBwko <bouwko@gmail.com>2016-12-01 00:56:15 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2016-12-02 07:41:19 +0100
commit4ff0db0246fa8a2add1032220024975203b93d72 (patch)
tree6395dd608ba47cc6429bc12d9595f09ebb915f02 /cmd/dump.go
parent5ab85372da74bd95f7143fd59c2c600d4c9894d0 (diff)
downloadgitea-4ff0db0246fa8a2add1032220024975203b93d72.tar.gz
gitea-4ff0db0246fa8a2add1032220024975203b93d72.zip
Catch os... errors
Diffstat (limited to 'cmd/dump.go')
-rw-r--r--cmd/dump.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/dump.go b/cmd/dump.go
index 027f251a0c..d17b5e2fb0 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -79,7 +79,6 @@ func runDump(ctx *cli.Context) error {
log.Printf("Packing dump files...")
z, err := zip.Create(fileName)
if err != nil {
- os.Remove(fileName)
log.Fatalf("Fail to create %s: %v", fileName, err)
}
@@ -102,7 +101,7 @@ func runDump(ctx *cli.Context) error {
}
// FIXME: SSH key file.
if err = z.Close(); err != nil {
- os.Remove(fileName)
+ _ = os.Remove(fileName)
log.Fatalf("Fail to save %s: %v", fileName, err)
}
@@ -111,7 +110,10 @@ func runDump(ctx *cli.Context) error {
}
log.Printf("Removing tmp work dir: %s", TmpWorkDir)
- os.RemoveAll(TmpWorkDir)
+
+ if err := os.RemoveAll(TmpWorkDir); err != nil {
+ log.Fatalf("Fail to remove %s: %v", TmpWorkDir, err)
+ }
log.Printf("Finish dumping in file %s", fileName)
return nil