diff --git a/infer/lib/python/infer b/infer/lib/python/infer index 530c27b07..41435c49b 100755 --- a/infer/lib/python/infer +++ b/infer/lib/python/infer @@ -126,8 +126,8 @@ def main(): if imported_module: analyze.create_results_dir(args.infer_out) - if not args.continue_capture: - analyze.reset_start_file(args.infer_out) + analyze.reset_start_file(args.infer_out, + touch_if_present=not args.continue_capture) utils.configure_logging(args) logging.info('Running command %s', ' '.join(sys.argv)) diff --git a/infer/lib/python/inferlib/analyze.py b/infer/lib/python/inferlib/analyze.py index 909ff079c..bd2f177c2 100644 --- a/infer/lib/python/inferlib/analyze.py +++ b/infer/lib/python/inferlib/analyze.py @@ -175,10 +175,11 @@ def create_results_dir(results_dir): utils.mkdir_if_not_exists(os.path.join(results_dir, 'sources')) -def reset_start_file(results_dir): - # create new empty file - this will update modified timestamp - open(os.path.join(results_dir, '.start'), 'w').close() - +def reset_start_file(results_dir, touch_if_present=False): + start_path = os.path.join(results_dir, '.start') + if (not os.path.exists(start_path)) or touch_if_present: + # create new empty file - this will update modified timestamp + open(start_path, 'w').close() def clean(infer_out): directories = [