manually process asynchonously

This commit is contained in:
Darryl Nixon 2023-07-16 14:47:22 -07:00
parent b710595271
commit f81d1d4a64

View file

@ -76,7 +76,7 @@ async def main(job: argparse.Namespace) -> bool:
# scandir/glob/rglob doesn't play nice with FileNotFound errors, # scandir/glob/rglob doesn't play nice with FileNotFound errors,
# so let's avoid them entirely for now in /proc, /dev, and /sys # so let's avoid them entirely for now in /proc, /dev, and /sys
check_paths = [mount_point / path for path in ("/proc", "/dev", "/sys")] check_paths = [mount_point / path for path in ("/proc", "/dev", "/sys")]
manual_process = any(await path.exists() for path in check_paths) manual_process = any(asyncio.gather(*[path.exists() for path in check_paths]))
if manual_process: if manual_process:
# Traverse every directory in mount_point recursively except /proc, /dev, and /sys # Traverse every directory in mount_point recursively except /proc, /dev, and /sys
async for item in mount_point.glob("*"): async for item in mount_point.glob("*"):