fileset

git mirror of https://ccx.te2000.cz/bzr/fileset
git clone https://ccx.te2000.cz/git/fileset
Log | Files | Refs | README

commit b3942e17c8305b2185a8fea76ab55b3626cbde54
parent fda4d61014bf57f50c4f6f6f542cf24b9a19ae59
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Wed, 21 Nov 2018 16:51:58 +0100

Don't forget to close the memory mapping.
Diffstat:
Mbin/fslist.py | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/fslist.py b/bin/fslist.py @@ -127,9 +127,12 @@ def process_content(args, f, size, out): elif size > args.max_line_length: # Always use the multiline form for larger files mm = mmap.mmap(f.fileno(), 0, mmap.MAP_PRIVATE) - flags = ('n' if mm[-1] == '\n' else 'N') - out.statement('C%s\t' % flags, '') - out.indent_copy(mm) + try: + flags = ('n' if mm[-1] == '\n' else 'N') + out.statement('C%s\t' % flags, '') + out.indent_copy(mm) + finally: + mm.close() else: content = f.read() flags = 'N'