diff --git a/src/python/pants/backend/jvm/tasks/coursier/coursier_subsystem.py b/src/python/pants/backend/jvm/tasks/coursier/coursier_subsystem.py index fd6ffc2fb3d..a0f92ba78bb 100644 --- a/src/python/pants/backend/jvm/tasks/coursier/coursier_subsystem.py +++ b/src/python/pants/backend/jvm/tasks/coursier/coursier_subsystem.py @@ -77,9 +77,8 @@ def bootstrap_coursier(self, workunit_factory): bootstrap_jar_path = os.path.join(coursier_bootstrap_dir, 'coursier.jar') - with workunit_factory(name='bootstrap-coursier', labels=[WorkUnitLabel.TOOL]) as workunit: - - if not os.path.exists(bootstrap_jar_path): + if not os.path.exists(bootstrap_jar_path): + with workunit_factory(name='bootstrap-coursier', labels=[WorkUnitLabel.TOOL]) as workunit: with safe_concurrent_creation(bootstrap_jar_path) as temp_path: fetcher = Fetcher(get_buildroot()) checksummer = fetcher.ChecksumListener(digest=hashlib.sha1()) @@ -98,4 +97,4 @@ def bootstrap_coursier(self, workunit_factory): else: workunit.set_outcome(WorkUnit.SUCCESS) - return bootstrap_jar_path + return bootstrap_jar_path