Skip to content

Commit

Permalink
log: Close the file handler when it's removed
Browse files Browse the repository at this point in the history
Silences "ResourceWarning: unclosed file"

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
  • Loading branch information
Jussi Kukkonen committed Aug 5, 2020
1 parent 445b07a commit f6bfaf3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tuf/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ def disable_file_logging():

if file_handler:
logger.removeHandler(file_handler)
file_handler.close()
file_handler = None
logger.debug('Removed the file handler.')

Expand Down

0 comments on commit f6bfaf3

Please sign in to comment.