summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@iiso>2011-09-15 00:16:48 +0200
committertv <tv@iiso>2011-09-15 00:16:48 +0200
commit0db3ab13b036796dc9cd5cf045635484c34b9ae0 (patch)
tree701331ee244945c62da18cb8c5dac49b4e24b7dc
parent668ca493744636a5fe090d431f9d36e97be7907b (diff)
//hyper/process: connect outgoing pipes
-rw-r--r--hyper/process/src/hyper/process/process.go13
1 files changed, 10 insertions, 3 deletions
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)
+ }
}
}