From 0db3ab13b036796dc9cd5cf045635484c34b9ae0 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 15 Sep 2011 00:16:48 +0200 Subject: //hyper/process: connect outgoing pipes --- hyper/process/src/hyper/process/process.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'hyper/process') diff --git a/hyper/process/src/hyper/process/process.go b/hyper/process/src/hyper/process/process.go index a52197f0..18cf55fb 100644 --- a/hyper/process/src/hyper/process/process.go +++ b/hyper/process/src/hyper/process/process.go @@ -18,6 +18,7 @@ type Process struct { process_stdout *os.File process_stderr *os.File id string + client http.Client } func (p *Process) Id() string { @@ -99,18 +100,24 @@ func (hp *Process) Start() os.Error { file.Close() } - go reader(hp.process_stdout) - go reader(hp.process_stderr) + go hp.reader(hp.process_stdout, hp.Stdout) + go hp.reader(hp.process_stderr, hp.Stderr) return nil } -func reader(file *os.File) { +func (p *Process) reader(file *os.File, url string) { var b []byte = make([]byte, 1024) var err os.Error = nil for err == nil { var n int n, err = file.Read(b) fmt.Printf("data: %d, %s\n", n, b) + + res, err := p.client.Post(url, "application/octet-stream", bytes.NewBuffer(b)) + res = res + if err != nil { + fmt.Printf("EE: %s: %s\n", url, err) + } } } -- cgit v1.2.3