func (p *Packer) Execute() {
	if p.validate != nil {
		p.validate()
	}
	go p.writeOut()
	go p.writeErr()
	p.Add(2)
	scanner := bufio.NewScanner(p.in)
	for scanner.Scan() {
		p.processor.InChannel() <- scanner.Bytes()
	}
	close(p.processor.InChannel())
	p.Wait()
}
Execute starts processing the incoming messages.
package tpack
import (
	"bufio"
	"io"
	"os"
	"sync"
)
type Packer struct {
	sync.WaitGroup
	in        io.Reader
	out       io.Writer
	err       io.Writer
	processor Processor
	validate  func()
}
func NewPacker(in io.Reader, out io.Writer, err io.Writer, processor Processor) *Packer {
	return &Packer{
		in:        in,
		out:       out,
		err:       err,
		processor: processor,
		validate:  nil,
	}
}
func NewPackerStdOut(in io.Reader, processor Processor) *Packer {
	return &Packer{
		in:        in,
		out:       os.Stdout,
		err:       os.Stderr,
		processor: processor,
		validate:  nil,
	}
}
func NewPackerStd(processor Processor) *Packer {
	stdin := os.Stdin
	stdout := os.Stdout
	stderr := os.Stderr
	validate := func() {
		info, err := stdin.Stat()
		if err != nil {
			stderr.Write([]byte(err.Error()))
			os.Exit(-1)
		}
		if info.Mode()&os.ModeNamedPipe == 0 {
			stderr.Write([]byte("named pipe (FIFO)"))
			os.Exit(-1)
		}
	}
	return &Packer{
		in:        stdin,
		out:       stdout,
		err:       stderr,
		processor: processor,
		validate:  validate,
	}
}