in openwhisk/executor.go [80:107]
func (proc *Executor) Interact(in []byte) ([]byte, error) {
// input to the subprocess
proc.input.Write(in)
proc.input.Write([]byte("\n"))
chout := make(chan []byte)
go func() {
out, err := proc.output.ReadBytes('\n')
if err == nil {
chout <- out
} else {
chout <- []byte{}
}
}()
var err error
var out []byte
select {
case out = <-chout:
if len(out) == 0 {
err = errors.New("no answer from the action")
}
case <-proc.exited:
err = errors.New("command exited")
}
proc.cmd.Stdout.Write([]byte(OutputGuard))
proc.cmd.Stderr.Write([]byte(OutputGuard))
return out, err
}