From 62c4df62df0b96f8dc4d3ddb37a3b3bfe9cc54a6 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 5 Aug 2015 15:48:00 +0100 Subject: scripts: ensure tinfoil is shut down correctly We should always shut down tinfoil when we're finished with it, either by explicitly calling the shutdown() method or by using it as a context manager ("with ..."). Signed-off-by: Paul Eggleton --- scripts/devtool | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scripts/devtool') diff --git a/scripts/devtool b/scripts/devtool index b1274d69d8..91e3954dbb 100755 --- a/scripts/devtool +++ b/scripts/devtool @@ -289,17 +289,15 @@ def main(): if global_args.bbpath is None: tinfoil = setup_tinfoil(config_only=True, basepath=basepath) - global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True) - else: - tinfoil = None + try: + global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True) + finally: + tinfoil.shutdown() for path in [scripts_path] + global_args.bbpath.split(':'): pluginpath = os.path.join(path, 'lib', 'devtool') scriptutils.load_plugins(logger, plugins, pluginpath) - if tinfoil: - tinfoil.shutdown() - subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='') subparsers.required = True -- cgit 1.2.3-korg