[elbe-devel] [PATCH v3 2/7] filesystem: Add context manager for TmpdirFilesystem
Torben Hohn
torben.hohn at linutronix.de
Tue Aug 25 12:42:32 CEST 2020
On Thu, Aug 20, 2020 at 12:02:10PM -0400, Olivier Dion wrote:
> Signed-off-by: Olivier Dion <dion at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/filesystem.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
> index 51697907..683899b7 100644
> --- a/elbepack/filesystem.py
> +++ b/elbepack/filesystem.py
> @@ -507,6 +507,13 @@ class TmpdirFilesystem (Filesystem):
> def delete(self):
> shutil.rmtree(self.path, True)
>
> + def __enter__(self):
> + return self
> +
> + def __exit__(self, exec_type, exec_value, tb):
> + shutil.rmtree(self.path)
> + return False
> +
>
> class ImgMountFilesystem(Filesystem):
> def __init__(self, mntpoint, dev):
> --
> 2.28.0
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list