Started working on running the pipeline

This commit is contained in:
Leon Mika 2023-04-24 02:47:47 +00:00
parent 19446235e0
commit 1c08248c69
4 changed files with 85 additions and 0 deletions

19
exec.go Normal file
View 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)
}
}
}