command/push: close reader

This commit is contained in:
Mitchell Hashimoto 2014-10-28 19:34:19 -07:00
parent fbc1551048
commit 0f5ef2ce2b
2 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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",