Engine: integer job status, improved stream API

* Jobs return an integer status instead of a string
* Status convention mimics unix process execution: 0=success, 1=generic error, 127="no such command"
* Stdout and Stderr support multiple thread-safe data receivers and ring buffer filtering
Upstream-commit: bef8de93194a442c21481f0b7e72f2fac781f799
Component: engine
This commit is contained in:
Solomon Hykes
2013-12-11 11:52:59 -08:00
committed by Victor Vieux
parent d332e70646
commit de9d0dbb53
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ type Job struct {
Eng *Engine
Name string
Args []string
env *Env
env *Env
Stdout *Output
Stderr *Output
Stdin *Input
+2 -3
View File
@@ -168,7 +168,7 @@ func Tail(src io.Reader, n int, dst *[]string) {
// AddEnv starts a new goroutine which will decode all subsequent data
// as a stream of json-encoded objects, and point `dst` to the last
// decoded object.
// The result `env` can be queried using the type-neutral Env interface.
// The result `env` can be queried using the type-neutral Env interface.
// It is not safe to query `env` until the Output is closed.
func (o *Output) AddEnv() (dst *Env, err error) {
src, err := o.AddPipe()
@@ -185,9 +185,8 @@ func (o *Output) AddEnv() (dst *Env, err error) {
if err != nil {
return
}
*dst= *env
*dst = *env
}
}()
return dst, nil
}