From 393a019b784d07718e516f4206d1967df65d2827 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 7 Apr 2019 19:15:14 -0700 Subject: [PATCH] try rsync (works ok) Signed-off-by: Jeff Carr --- random-output/main.go | 3 ++- random-output/shell.go | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/random-output/main.go b/random-output/main.go index 170be59..262dc80 100644 --- a/random-output/main.go +++ b/random-output/main.go @@ -16,5 +16,6 @@ func main() { // simpleProcess("ping -c 10 localhost") // shell("ping localhost -c 5", 10) // shell("if=/home/pinebook/factory/factory-pine14inch of=/dev/sdb2 status=progress bs=1M oflag=sync count=300", 10) - shell("rsync -av --progress --inplace /home/pinebook/factory/factory-pine14inch work3.lab.wit.com:/home/pinebook/factory/") + // shell("rsync -av --progress --inplace /home/pinebook/factory/factory-pine14inch work3.lab.wit.com:/home/pinebook/factory/") + shell("rsync -av --progress /home/pinebook/factory/FACTORY-IMAGER-ROOTFS work3:/home/pinebook/factory/") } diff --git a/random-output/shell.go b/random-output/shell.go index 1c1c599..cd5e49d 100644 --- a/random-output/shell.go +++ b/random-output/shell.go @@ -34,21 +34,25 @@ func shell(cmdline string) { time.Sleep(2 * time.Millisecond) // only check the buffer 500 times a second // log.Println("sleep done") - oneByte := make([]byte, 10) + oneByte := make([]byte, 1024) count, err := nbr.Read(oneByte) if (err != nil) { log.Println("Read() count = ", count, "err = ", err) + oneByte = make([]byte, 1024) + count, err = nbr.Read(oneByte) + f.Write([]byte(string(oneByte))) + f.Flush() } f.Write([]byte(string(oneByte))) f.Flush() - oneByte = make([]byte, 10) + oneByte = make([]byte, 1024) count, err = nbrerr.Read(oneByte) if (err != nil) { - oneByte = make([]byte, 100) - count, err = nbr.Read(oneByte) + oneByte = make([]byte, 1024) + count, err = nbrerr.Read(oneByte) f.Write([]byte(string(oneByte))) f.Flush() @@ -63,8 +67,6 @@ func shell(cmdline string) { } // spew.Dump(reflect.ValueOf(cmd.Process).Elem()) -/* -*/ } cmd.Wait()