Skip to content

Commit

Permalink
clean up temporary directory on error
Browse files Browse the repository at this point in the history
  • Loading branch information
idroz committed Jun 28, 2023
1 parent 26b9c19 commit 19368d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func importMachine(cmd *cobra.Command, args []string) {
machineConfig, err := qemu.GetMachineConfig(importName)
if err != nil {
os.RemoveAll(targetDir)
os.RemoveAll(tempArchive)
log.Fatal("unable to import: " + err.Error())
}

Expand All @@ -87,6 +88,7 @@ func importMachine(cmd *cobra.Command, args []string) {
err = qemu.SaveMachineConfig(machineConfig)
if err != nil {
os.RemoveAll(targetDir)
os.RemoveAll(tempArchive)
log.Fatal("unable to import: " + err.Error())
}
}
Expand Down

0 comments on commit 19368d7

Please sign in to comment.