mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
removing tmp files when done
This commit is contained in:
parent
97ef587a0e
commit
e010a1633a
1 changed files with 7 additions and 3 deletions
|
@ -385,7 +385,7 @@ func copySrcSubProcFunc(proc process, cia copyInitialData) func(context.Context,
|
|||
chunkNumber++
|
||||
|
||||
// Create message and send data to dst
|
||||
fmt.Printf("**** DATA READ: %v\n", b)
|
||||
// fmt.Printf("**** DATA READ: %v\n", b)
|
||||
|
||||
csa := copySubData{
|
||||
CopyStatus: status,
|
||||
|
@ -555,7 +555,7 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
|||
switch csa.CopyStatus {
|
||||
case copyData:
|
||||
// Write the data chunk to disk ?
|
||||
fmt.Printf("\n * Received data: %s\n\n", csa.CopyData)
|
||||
// fmt.Printf("\n * Received data: %s\n\n", csa.CopyData)
|
||||
|
||||
func() {
|
||||
filePath := filepath.Join(tmpFolder, strconv.Itoa(csa.ChunkNumber)+"."+cia.UUID)
|
||||
|
@ -690,8 +690,12 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
|||
return
|
||||
}
|
||||
|
||||
// All ok, remove the backup file
|
||||
// All ok, remove the backup file, and tmp folder.
|
||||
os.Remove(backupOriginalFileName)
|
||||
err = os.RemoveAll(tmpFolder)
|
||||
if err != nil {
|
||||
log.Fatalf("error: copyDstSubProcFunc: remove temp dir failed: %v\n", err)
|
||||
}
|
||||
|
||||
// fmt.Printf("main file contains: %v\n", mainFileData)
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue