You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/02/28 08:33:33 UTC
[buildstream] 03/04: element.py: Ensure that sandboxes are used within `with` statements
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/fix-leaking-grpc-threads
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 1129965776313437c6237dfe21e5c59c4dc78d67
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Feb 28 17:28:38 2022 +0900
element.py: Ensure that sandboxes are used within `with` statements
---
src/buildstream/element.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index e891349..419353c 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2777,7 +2777,7 @@ class Element(Plugin):
self.info("Using a remote sandbox for artifact {} with directory '{}'".format(self.name, directory))
- sandbox = SandboxRemote(
+ with SandboxRemote(
context,
project,
directory,
@@ -2786,8 +2786,8 @@ class Element(Plugin):
stderr=stderr,
config=config,
output_node_properties=output_node_properties,
- )
- yield sandbox
+ ) as sandbox:
+ yield sandbox
elif directory is not None and os.path.exists(directory):
platform = context.platform
@@ -2803,7 +2803,8 @@ class Element(Plugin):
config=config,
output_node_properties=output_node_properties,
)
- yield sandbox
+ with sandbox:
+ yield sandbox
else:
os.makedirs(context.builddir, exist_ok=True)