From edacdc5e25c70e73e1f82b1bb19abe52e9cfe846 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jan 2020 12:58:21 +0100 Subject: [PATCH] Use python context manager to open file --- kitty/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kitty/main.py b/kitty/main.py index 731a62593..2791946ee 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -177,7 +177,8 @@ def setup_profiling(args): exe = kitty_exe() cg = '/tmp/kitty-profile.callgrind' print('Post processing profile data for', exe, '...') - subprocess.call(['pprof', '--callgrind', exe, '/tmp/kitty-profile.log'], stdout=open(cg, 'wb')) + with open(cg, 'wb') as f: + subprocess.call(['pprof', '--callgrind', exe, '/tmp/kitty-profile.log'], stdout=f) try: subprocess.Popen(['kcachegrind', cg]) except FileNotFoundError: