From dc9f8a7a0161ef08c8abb1e2de6cbfae52f92823 Mon Sep 17 00:00:00 2001 From: Tony Cosentini Date: Wed, 13 Jan 2016 19:24:18 -0800 Subject: [PATCH] Don't create infer-out directory or logs unless analyzing something. Summary: This will stop Infer from creating an `infer-out` directory when just running `infer`. (I run `infer` without any arguments somewhat often to look at documenting.) One downside to this is that there will be no logs when running Infer without any commands - is this bad? Closes https://github.com/facebook/infer/pull/240 Reviewed By: cristianoc Differential Revision: D2829752 Pulled By: jeremydubreil fb-gh-sync-id: 6827ef9 --- infer/lib/python/infer | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/infer/lib/python/infer b/infer/lib/python/infer index e6d436ac5..391db8e50 100755 --- a/infer/lib/python/infer +++ b/infer/lib/python/infer @@ -129,19 +129,19 @@ def main(): capture_module_name != 'analyze'): analyze.remove_infer_out(args.infer_out) - analyze.create_results_dir(args.infer_out) + if imported_module: + analyze.create_results_dir(args.infer_out) - configure_logging(args.infer_out, args.log_to_stderr) - logging.info('Running command %s', ' '.join(sys.argv)) - logging.info('Path to infer script %s (%s)', __file__, + configure_logging(args.infer_out, args.log_to_stderr) + logging.info('Running command %s', ' '.join(sys.argv)) + logging.info('Path to infer script %s (%s)', __file__, os.path.realpath(__file__)) - logging.info(analyze.get_infer_version()) - logging.info('Platform: %s', platform.platform()) - logging.info('PATH=%s', os.getenv('PATH')) - logging.info('SHELL=%s', os.getenv('SHELL')) - logging.info('PWD=%s', os.getenv('PWD')) + logging.info(analyze.get_infer_version()) + logging.info('Platform: %s', platform.platform()) + logging.info('PATH=%s', os.getenv('PATH')) + logging.info('SHELL=%s', os.getenv('SHELL')) + logging.info('PWD=%s', os.getenv('PWD')) - if imported_module: capture_exitcode = imported_module.gen_instance(args, cmd).capture() if capture_exitcode != os.EX_OK: logging.error('Error during capture phase, exiting')