diff --git a/command/push.go b/command/push.go index 1b43be6b9..dc4cd783f 100644 --- a/command/push.go +++ b/command/push.go @@ -83,6 +83,7 @@ func (c *PushCommand) Run(args []string) int { c.Ui.Error(fmt.Sprintf("Error archiving: %s", err)) return 1 } + defer r.Close() // Start the upload process doneCh, uploadErrCh, err := c.upload(r, &uploadOpts) diff --git a/command/push_test.go b/command/push_test.go index b57276e5f..2d8222cfa 100644 --- a/command/push_test.go +++ b/command/push_test.go @@ -29,10 +29,10 @@ func TestPush_multiArgs(t *testing.T) { } func TestPush(t *testing.T) { - var actualR io.Reader + var actual []string var actualOpts *uploadOpts uploadFn := func(r io.Reader, opts *uploadOpts) (<-chan struct{}, <-chan error, error) { - actualR = r + actual = testArchive(t, r) actualOpts = opts doneCh := make(chan struct{}) @@ -50,7 +50,6 @@ func TestPush(t *testing.T) { fatalCommand(t, c.Meta) } - actual := testArchive(t, actualR) expected := []string{ archiveTemplateEntry, "template.json",