diff --git a/check.anko b/check.anko index 1467f34..ced00d3 100644 --- a/check.anko +++ b/check.anko @@ -6,3 +6,5 @@ if v < 55 { println("it fucking works") } +rcmd("goblin", "ls", "-r", "100", "src") && println("it works also") + diff --git a/src/tool/anko/anko.go b/src/tool/anko/anko.go index a9c6eb4..15ea2b6 100644 --- a/src/tool/anko/anko.go +++ b/src/tool/anko/anko.go @@ -106,46 +106,22 @@ func setupEnv() { if err != nil { panic(err) } - - obuf := make([]byte, 512) - go func() { - var ( - err error - n int - ) - for { - n, err = stdout.Read(obuf) - output.Write(obuf[:n]) - if err == io.EOF { - break - } else if err != nil { - panic(err) - } + go func(){ + _, err = io.Copy(stdin, input) + if err != nil { + panic(err) } - stdout.Close() }() - - ibuf := make([]byte, 512) go func() { - var ( - err error - n int - ) - for { - n, err = input.Read(ibuf) - stdin.Write(ibuf[:n]) - if err == io.EOF { - break - } else if err != nil { - panic(err) - } + _, err = io.Copy(output, stdout) + if err != nil { + panic(err) } - stdin.Close() }() err = rcmd.Wait() if err != nil { - //fmt.Println(err) + fmt.Println(err) return false }