From c228a212b0692736df29164b054ec43476a36dde Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 16 Aug 2015 23:02:02 +0200 Subject: [PATCH] SetupTarTestFixture: don't depend on "sh" --- test/helpers.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/helpers.go b/test/helpers.go index 504b582ca..f04ac24ac 100644 --- a/test/helpers.go +++ b/test/helpers.go @@ -88,19 +88,18 @@ func RandomReader(seed, size int) *bytes.Reader { // SetupTarTestFixture extracts the tarFile to outputDir. func SetupTarTestFixture(t testing.TB, outputDir, tarFile string) { - err := System("sh", "-c", `(cd "$1" && tar xzf - ) < "$2"`, - "sh", outputDir, tarFile) + f, err := os.Open(tarFile) + defer f.Close() OK(t, err) -} -// System runs the command and returns the exit code. Output is passed on to -// stdout/stderr. -func System(command string, args ...string) error { - cmd := exec.Command(command, args...) + cmd := exec.Command("tar", "xzf", "-") + cmd.Dir = outputDir + + cmd.Stdin = f cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr - return cmd.Run() + OK(t, cmd.Run()) } // WithTestEnvironment creates a test environment, extracts the repository