stoop it.

This commit is contained in:
Andrey Parhomenko 2023-06-04 22:10:30 +03:00
parent 5dc0759533
commit ccc9c1a578

View file

@ -78,7 +78,7 @@ func setupEnv() {
panic("too few arguments") panic("too few arguments")
} }
cmd := exec.Command(args[0], args...) cmd := exec.Command(args[0], args[1:]...)
return &Cmd{ return &Cmd{
Cmd: cmd, Cmd: cmd,
@ -111,25 +111,32 @@ func setupEnv() {
ibuf := make([]byte, 512) ibuf := make([]byte, 512)
obuf := make([]byte, 512) obuf := make([]byte, 512)
for {
fmt.Println("in") go func() {
ni, err := input.Read(ibuf) for {
stdin.Write(ibuf[:ni]) no, err := stdout.Read(obuf)
if err == io.EOF { output.Write(obuf[:no])
break if err == io.EOF {
} else if err != nil { break
fmt.Println("check") } else if err != nil {
panic(err) panic(err)
}
} }
stdout.Close()
no, err := stdout.Read(obuf) }()
output.Write(obuf[:no])
if err == io.EOF { go func() {
break for {
} else if err != nil { ni, err := input.Read(ibuf)
panic(err) stdin.Write(ibuf[:ni])
if err == io.EOF {
break
} else if err != nil {
panic(err)
}
} }
} stdin.Close()
}()
err = rcmd.Wait() err = rcmd.Wait()
if err != nil { if err != nil {