Skip to content

Commit

Permalink
utils/kamctl: dbtextdb.py close previous opened file properly
Browse files Browse the repository at this point in the history
related #1747

(cherry picked from commit 5f52f99)
(cherry picked from commit e26e587)
  • Loading branch information
linuxmaniac committed May 4, 2020
1 parent 0d9c72b commit 4061a1d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions utils/kamctl/dbtextdb/dbtextdb.py
Expand Up @@ -60,6 +60,10 @@ def __init__(self, location):
if not os.path.isdir(location):
raise ParseError(location + ' is not a directory')

def __del__(self):
if getattr(self, 'fd', False):
self.fd.close()

def _ParseOrderBy(self):
"""Parse out the column name to be used for ordering the dataset.
Expand Down Expand Up @@ -438,6 +442,8 @@ def CleanUp(self):
self.command = '' # which command are we executing
self.strings = [] # list of string literals parsed from the query
self.parens = [] # list of parentheses parsed from the query
if getattr(self, 'fd', False):
self.fd.close()

def ParseQuery(self, query):
"""External wrapper for the query parsing routines.
Expand Down

0 comments on commit 4061a1d

Please sign in to comment.