Started working on running the pipeline
This commit is contained in:
parent
19446235e0
commit
1c08248c69
4 changed files with 85 additions and 0 deletions
19
exec.go
Normal file
19
exec.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package scriptx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Runnable interface {
|
||||
Stdout() (int, error)
|
||||
}
|
||||
|
||||
func Run(pipes ...Runnable) {
|
||||
for _, pipe := range pipes {
|
||||
if _, err := pipe.Stdout(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue