From c4275519ae69458b75839ea199e390b07e1a3cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 18 Mar 2017 19:05:56 +0100 Subject: [PATCH] Split runExecCmdWithInput from runCommandWithInput This does not change behavior yet; runExecCmdWithInput will be used in the future by callers who need to modify the exec.Cmd. --- integration/utils.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/integration/utils.go b/integration/utils.go index a6b85111..c58afeed 100644 --- a/integration/utils.go +++ b/integration/utils.go @@ -74,9 +74,15 @@ func assertSkopeoFails(c *check.C, regexp string, args ...string) { // runCommandWithInput runs a command as if exec.Command(), sending it the input to stdin, // and verifies that the exit status is 0, or terminates c on failure. func runCommandWithInput(c *check.C, input string, name string, args ...string) { - c.Logf("Running %s %s", name, strings.Join(args, " ")) cmd := exec.Command(name, args...) - consumeAndLogOutputs(c, name+" "+strings.Join(args, " "), cmd) + runExecCmdWithInput(c, cmd, input) +} + +// runExecCmdWithInput runs an exec.Cmd, sending it the input to stdin, +// and verifies that the exit status is 0, or terminates c on failure. +func runExecCmdWithInput(c *check.C, cmd *exec.Cmd, input string) { + c.Logf("Running %s %s", cmd.Path, strings.Join(cmd.Args, " ")) + consumeAndLogOutputs(c, cmd.Path+" "+strings.Join(cmd.Args, " "), cmd) stdin, err := cmd.StdinPipe() c.Assert(err, check.IsNil) err = cmd.Start()