Skip to content

Commit

Permalink
Remove tmp file
Browse files Browse the repository at this point in the history
  • Loading branch information
Biptaste committed Apr 27, 2022
1 parent c4eb45b commit 34945cf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion actions/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ func RestoreActionHandler(ctx domain.ExecutionContext, file string, restoreConfi

// remove decrypted file
if isEncrypted {
os.Remove(file)
err = os.Remove(file)
if err != nil {
fmt.Println(err)
return
}
}

fmt.Printf("\n %s Done\n", color.GreenString("✓"))
Expand All @@ -102,6 +106,11 @@ func decrypt(file string, key *string) (string, error) {
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
removeErr := os.Remove(outputFile)
if removeErr != nil {
fmt.Println(removeErr)
}

return "", fmt.Errorf(fmt.Sprint(err) + ": " + stderr.String())
}
fmt.Printf("\n %s %s decrypted\n", color.GreenString("✓"), file)
Expand Down

0 comments on commit 34945cf

Please sign in to comment.