Commit 0f5ef2ce authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

command/push: close reader

parent fbc15510
...@@ -83,6 +83,7 @@ func (c *PushCommand) Run(args []string) int { ...@@ -83,6 +83,7 @@ func (c *PushCommand) Run(args []string) int {
c.Ui.Error(fmt.Sprintf("Error archiving: %s", err)) c.Ui.Error(fmt.Sprintf("Error archiving: %s", err))
return 1 return 1
} }
defer r.Close()
// Start the upload process // Start the upload process
doneCh, uploadErrCh, err := c.upload(r, &uploadOpts) doneCh, uploadErrCh, err := c.upload(r, &uploadOpts)
......
...@@ -29,10 +29,10 @@ func TestPush_multiArgs(t *testing.T) { ...@@ -29,10 +29,10 @@ func TestPush_multiArgs(t *testing.T) {
} }
func TestPush(t *testing.T) { func TestPush(t *testing.T) {
var actualR io.Reader var actual []string
var actualOpts *uploadOpts var actualOpts *uploadOpts
uploadFn := func(r io.Reader, opts *uploadOpts) (<-chan struct{}, <-chan error, error) { uploadFn := func(r io.Reader, opts *uploadOpts) (<-chan struct{}, <-chan error, error) {
actualR = r actual = testArchive(t, r)
actualOpts = opts actualOpts = opts
doneCh := make(chan struct{}) doneCh := make(chan struct{})
...@@ -50,7 +50,6 @@ func TestPush(t *testing.T) { ...@@ -50,7 +50,6 @@ func TestPush(t *testing.T) {
fatalCommand(t, c.Meta) fatalCommand(t, c.Meta)
} }
actual := testArchive(t, actualR)
expected := []string{ expected := []string{
archiveTemplateEntry, archiveTemplateEntry,
"template.json", "template.json",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment