Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Output Module in Followstream #97

Merged
merged 1 commit into from Nov 18, 2016
Merged

Close Output Module in Followstream #97

merged 1 commit into from Nov 18, 2016

Conversation

amm3
Copy link
Contributor

@amm3 amm3 commented Nov 16, 2016

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 because out now differs from decoder.out within decode's main.

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.

@dev195
Copy link
Contributor

dev195 commented Nov 18, 2016

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

@dev195 dev195 merged commit e4da987 into USArmyResearchLab:master Nov 18, 2016
@amm3
Copy link
Contributor Author

amm3 commented Nov 18, 2016

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants