diff --git a/make-sdcard/main.go b/make-sdcard/main.go index 4d0cb41..7c63adb 100644 --- a/make-sdcard/main.go +++ b/make-sdcard/main.go @@ -75,7 +75,7 @@ func format(mybut *ui.Button) { simpleProcess("ls -l") os.Chdir("/mnt") simpleProcess("pwd") - simpleProcess("ls -l") + simpleProcess("ls -l /aksd") return simpleProcess("parted -s /dev/sdb mklabel msdos") simpleProcess("parted -s /dev/sdb mkpart primary ext4 1MiB 8GB") diff --git a/make-sdcard/ping.go b/make-sdcard/ping.go index ad30bee..a356774 100644 --- a/make-sdcard/ping.go +++ b/make-sdcard/ping.go @@ -70,6 +70,7 @@ func simpleProcess(cmd string) { // cmd := exec.Command("ls", "/tmp", "/ballon", "/") cmdArgs := strings.Fields(cmd) + (a, b) := strings.Fields(cmd) process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...) stdout, _ := process.StdoutPipe() stderr, _ := process.StderrPipe() @@ -79,8 +80,6 @@ func simpleProcess(cmd string) { fmt.Println("start ls /tmp pid =", pid) log.Println(reflect.ValueOf(process.Process).Elem()) log.Println(reflect.TypeOf(process.Process)) - spew.Dump(process) - merged := io.MultiReader(stderr, stdout) scanner := bufio.NewScanner(merged) @@ -95,7 +94,9 @@ func simpleProcess(cmd string) { // One must wait for the process to formally finish and flush all buffer output process.Wait() - log.Println("END " + cmd) + spew.Dump(process.ProcessState) + err := process.ProcessState // this should be the exit code of the process + log.Println("END " + cmd, err) } func exampleScanner() {