Improved notifications
Added progress indicator in clone output
This commit is contained in:
parent
e77ab09050
commit
624c112176
6
clone.go
6
clone.go
@ -10,6 +10,7 @@ package main
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -31,7 +32,7 @@ func clone(cloneBs int, cloneSource string, cloneTarget string) {
|
|||||||
}
|
}
|
||||||
defer fTarget.Close()
|
defer fTarget.Close()
|
||||||
errorHandler(err)
|
errorHandler(err)
|
||||||
//todo progress indicator
|
progress := cloneBs
|
||||||
for {
|
for {
|
||||||
n, err := fSource.Read(p)
|
n, err := fSource.Read(p)
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
@ -42,6 +43,9 @@ func clone(cloneBs int, cloneSource string, cloneTarget string) {
|
|||||||
errorHandler(err)
|
errorHandler(err)
|
||||||
_, err = fTarget.Write(p[:n])
|
_, err = fTarget.Write(p[:n])
|
||||||
errorHandler(err)
|
errorHandler(err)
|
||||||
|
fmt.Println(progress/1048576, "MB written...")
|
||||||
|
progress += cloneBs
|
||||||
}
|
}
|
||||||
|
fmt.Println("Performing sync operations...")
|
||||||
fTarget.Sync()
|
fTarget.Sync()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user