[elbe-devel] [PATCH 4/7] elbepack: efilesystem: create existack earlier
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Dec 17 13:24:27 CET 2024
All resource lifecycles are about to be managed by the exitstack.
Create it as early as possible.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/efilesystem.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 305a9d2d6f96b3725a003efa613bda883d802856..7b6e67949d6b9da5c677d07b12e0e0d927577baa 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -306,6 +306,8 @@ class ChRootFilesystem(ElbeFilesystem):
os.close(self.cwd)
def __enter__(self):
+ self._exitstack = contextlib.ExitStack()
+
self._excursions = [
Excursion('/etc/resolv.conf'),
Excursion('/etc/apt/apt.conf'),
@@ -326,7 +328,6 @@ class ChRootFilesystem(ElbeFilesystem):
for excursion in self._excursions:
excursion.do(self)
- self._exitstack = contextlib.ExitStack()
if self.path != '/':
self._exitstack.enter_context(
mount(None, self.fname('/proc'), type='proc', log_output=False))
--
2.47.1
More information about the elbe-devel
mailing list