From 74905c8473cefffff4c63f13ae377e1d8b8f71fe Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Mon, 18 May 2015 13:38:30 +0200 Subject: [PATCH] Write snapshot even in case of sys.exit(0) (PY-15905) --- python/helpers/profiler/run_profiler.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/helpers/profiler/run_profiler.py b/python/helpers/profiler/run_profiler.py index dc60a201d37b..1b01dea126fc 100644 --- a/python/helpers/profiler/run_profiler.py +++ b/python/helpers/profiler/run_profiler.py @@ -81,10 +81,11 @@ class Profiler(object): self.start_profiling() - pydev_imports.execfile(file, globals, globals) # execute the script - - self.stop_profiling() - self.save_snapshot(0, generate_snapshot_filepath(base_snapshot_path, remote_run), remote_run) + try: + pydev_imports.execfile(file, globals, globals) # execute the script + finally: + self.stop_profiling() + self.save_snapshot(0, generate_snapshot_filepath(base_snapshot_path, remote_run), remote_run) def start_profiling(self): self.profiling_backend.enable()