From 0bd92e6314b799afec447c1e30260d9a8dfad894 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 17 Sep 2020 10:55:26 +0200 Subject: make vim-ide-integration: fix ResourceWarning Exception ignored in: <_io.FileIO name='compile_commands.json' mode='wb' closefd=True> ResourceWarning: unclosed file <_io.TextIOWrapper name='compile_commands.json' mode='w' encoding='UTF-8'> Change-Id: I2ab4275a9b7897f5cd9e88b20a1eea4c68fe0d1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102907 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- bin/gbuild-to-ide | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/gbuild-to-ide') diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 7a6964abd454..bba9a9896b8a 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -548,8 +548,8 @@ class VimIntegrationGenerator(IdeIntegrationGenerator): entry = {'directory': lib.location, 'file': filePath, 'command': self.generateCommand(lib, filePath)} entries.append(entry) global_list.extend(entries) - export_file = open('compile_commands.json', 'w') - json.dump(global_list, export_file) + with open('compile_commands.json', 'w') as export_file: + json.dump(global_list, export_file) def generateCommand(self, lib, file): command = 'clang++ -Wall' -- cgit