Skip to content

Commit

Permalink
Fix Close implementation of plugins (#305)
Browse files Browse the repository at this point in the history
Indeed they do not declare error as return type and so, were not called at the end of the program
  • Loading branch information
mlallaouret authored and buger committed Jun 16, 2016
1 parent 95eecb6 commit d0e1858
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion input_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ func (i *FileInput) emit() {
log.Printf("FileInput: end of file '%s'\n", i.path)
}

func (i *FileInput) Close() {
func (i *FileInput) Close() error {
i.currentFile.Close()
return nil
}
3 changes: 2 additions & 1 deletion input_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ func (i *RAWInput) String() string {
return "Intercepting traffic from: " + i.address
}

func (i *RAWInput) Close() {
func (i *RAWInput) Close() error {
i.listener.Close()
close(i.quit)
return nil
}
3 changes: 2 additions & 1 deletion output_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (o *FileOutput) String() string {
return "File output: " + o.file.Name()
}

func (o *FileOutput) Close() {
func (o *FileOutput) Close() error {
if o.file != nil {
if strings.HasSuffix(o.currentName, ".gz") {
o.writer.(*gzip.Writer).Close()
Expand All @@ -237,4 +237,5 @@ func (o *FileOutput) Close() {
}
o.file.Close()
}
return nil
}

0 comments on commit d0e1858

Please sign in to comment.