runner: pipe commands together

This commit is contained in:
Sam Hoffman
2026-01-31 00:29:33 -05:00
parent 1f1e2db229
commit d6a01c4ee2
2 changed files with 42 additions and 0 deletions

View File

@@ -2,9 +2,11 @@ package runner_test
import (
"context"
"os/exec"
"testing"
"git.gentoo.party/sam/thanks/internal/runner"
"github.com/stretchr/testify/assert"
)
func Test_ZCommand(t *testing.T) {
@@ -19,3 +21,12 @@ func Test_ZCommand(t *testing.T) {
t.Errorf("localRunner failed: %s\n\n%s", err.Error(), out)
}
}
func Test_Pipelie(t *testing.T) {
c1 := exec.Command("echo", "-n", "foo")
c2 := exec.Command("rev")
out, err := runner.Pipeline(c1, c2)
assert.Equal(t, "oof", string(out))
assert.Nil(t, err)
}