mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 05:01:29 +00:00
Use 'with' statements for file open/close. #1834
This commit is contained in:
@@ -485,13 +485,10 @@ for dir in dirs:
|
||||
if INSTALLED_FILES_NAME == self.record:
|
||||
distutils.log.warn("warning: installation record is overwriting "
|
||||
"--record file '%s'." % self.record)
|
||||
f = open(INSTALLED_FILES_NAME, "w")
|
||||
try:
|
||||
with open(INSTALLED_FILES_NAME, "w") as f:
|
||||
for output in self.get_installed_files():
|
||||
assert "\n" not in output
|
||||
print >> f, output
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
|
||||
class my_uninstall(Command):
|
||||
|
||||
Reference in New Issue
Block a user