mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-15 17:51:15 +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++
|
chunkNumber++
|
||||||
|
|
||||||
// Create message and send data to dst
|
// Create message and send data to dst
|
||||||
fmt.Printf("**** DATA READ: %v\n", b)
|
// fmt.Printf("**** DATA READ: %v\n", b)
|
||||||
|
|
||||||
csa := copySubData{
|
csa := copySubData{
|
||||||
CopyStatus: status,
|
CopyStatus: status,
|
||||||
|
@ -555,7 +555,7 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
||||||
switch csa.CopyStatus {
|
switch csa.CopyStatus {
|
||||||
case copyData:
|
case copyData:
|
||||||
// Write the data chunk to disk ?
|
// 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() {
|
func() {
|
||||||
filePath := filepath.Join(tmpFolder, strconv.Itoa(csa.ChunkNumber)+"."+cia.UUID)
|
filePath := filepath.Join(tmpFolder, strconv.Itoa(csa.ChunkNumber)+"."+cia.UUID)
|
||||||
|
@ -690,8 +690,12 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// All ok, remove the backup file
|
// All ok, remove the backup file, and tmp folder.
|
||||||
os.Remove(backupOriginalFileName)
|
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)
|
// fmt.Printf("main file contains: %v\n", mainFileData)
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in a new issue