From d0e1858eb3323bc4b43c058df3191c0391d6c240 Mon Sep 17 00:00:00 2001 From: Marc Lallaouret Date: Thu, 16 Jun 2016 18:33:07 +0200 Subject: [PATCH] Fix `Close` implementation of plugins (#305) Indeed they do not declare error as return type and so, were not called at the end of the program --- input_file.go | 3 ++- input_raw.go | 3 ++- output_file.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/input_file.go b/input_file.go index b562a99..ba3f542 100644 --- a/input_file.go +++ b/input_file.go @@ -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 } diff --git a/input_raw.go b/input_raw.go index c67cd8c..7b92096 100644 --- a/input_raw.go +++ b/input_raw.go @@ -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 } diff --git a/output_file.go b/output_file.go index fc0965e..4c863fc 100644 --- a/output_file.go +++ b/output_file.go @@ -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() @@ -237,4 +237,5 @@ func (o *FileOutput) Close() { } o.file.Close() } + return nil }