Closed amm3 closed 7 years ago
Nice catch!
We'll accept your pull request in the short-term, and work on a more long-term solution over the next few weeks. I noticed this bug also bites other decoders that work the same way (e.g. the new voip/sip.py decoder).
Sounds good! I've got another minor pull coming in followstream, but I wanted to make sure you guys were good with this one before sending it up. Thanks...
I recently noted that the closing body and html tags were not being applied in HTML output from followstream. Looking into it further, I noted that when output modules are instantiated from within the decoder's
__init__
, they are not closed by decode.py becauseout
now differs fromdecoder.out
within decode'smain
.I explored calling
self.out.close()
from the decoder's__del__
, but by the time this function is called (at the end of decode.py's main) the filehandle (decoder.out.fh
=out.fh
) has been closed, so colorout's attempt to write the closing tags generates a ValueError (I/O operation on closed file).Another approach would be to test each decoder at the end of
main
to see if its output decoder is equal to the default out and close it appropriately, but I didn't want to make this change unilaterally.