From 09bbc4f11f32d91dfa20aeb3da77a5e2a054f49d Mon Sep 17 00:00:00 2001 From: ionite34 Date: Sat, 19 Nov 2022 10:56:37 -0500 Subject: Use rmdir instead of rmtree --- snekbox/memfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snekbox/memfs.py b/snekbox/memfs.py index f45e37a..2372d43 100644 --- a/snekbox/memfs.py +++ b/snekbox/memfs.py @@ -7,7 +7,6 @@ import subprocess from collections.abc import Generator from contextlib import contextmanager from pathlib import Path -from shutil import rmtree from threading import BoundedSemaphore from types import TracebackType from typing import Type @@ -48,7 +47,8 @@ def unmount_tmpfs(name: str) -> None: """Unmount and remove a tmpfs directory.""" tmp = NAMESPACE_DIR / name subprocess.check_call(["umount", str(tmp)]) - rmtree(tmp, ignore_errors=True) + # Unmounting will not remove the original folder, so do that here + tmp.rmdir() class MemFS: -- cgit v1.2.3