diff options
| author | tv <tv@iiso> | 2011-09-15 00:16:48 +0200 | 
|---|---|---|
| committer | tv <tv@iiso> | 2011-09-15 00:16:48 +0200 | 
| commit | 0db3ab13b036796dc9cd5cf045635484c34b9ae0 (patch) | |
| tree | 701331ee244945c62da18cb8c5dac49b4e24b7dc /hyper/process/src | |
| parent | 668ca493744636a5fe090d431f9d36e97be7907b (diff) | |
//hyper/process: connect outgoing pipes
Diffstat (limited to 'hyper/process/src')
| -rw-r--r-- | hyper/process/src/hyper/process/process.go | 13 | 
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) +    }    }  }  | 
