This commit is contained in:
Sam Hoffman
2026-01-31 00:31:01 -05:00
parent d6a01c4ee2
commit b39d8d2d06

View File

@@ -28,6 +28,8 @@ func (runner *ZRunner) Run(ctx context.Context, command string, formatArgs ...an
return cmd.CombinedOutput() return cmd.CombinedOutput()
} }
// Pipeline accepts a slice of [exec.Cmd] and pipes them together
// then returns the result of the final command
func Pipeline(cmds ...*exec.Cmd) ([]byte, error) { func Pipeline(cmds ...*exec.Cmd) ([]byte, error) {
for i := 0; i < len(cmds)-1; i++ { for i := 0; i < len(cmds)-1; i++ {
stdout, err := cmds[i].StdoutPipe() stdout, err := cmds[i].StdoutPipe()