From 76b07f94628a3b3e38578264412e55a6126c57a4 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 25 Aug 2023 11:07:52 +0000 Subject: [PATCH] btdu.main: Fail gracefully when we can't parse /proc/mounts --- source/btdu/main.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/btdu/main.d b/source/btdu/main.d index 94e4c7b..bcbd1a6 100644 --- a/source/btdu/main.d +++ b/source/btdu/main.d @@ -35,7 +35,7 @@ import std.stdio : stdin, stdout, stderr; import std.string; import std.typecons; -import ae.sys.file : getMounts, getPathMountInfo; +import ae.sys.file : getMounts, getPathMountInfo, MountInfo; import ae.sys.shutdown; import ae.utils.funopt; import ae.utils.main; @@ -283,7 +283,10 @@ void checkBtrfs(string fsPath) enforce(fd.isBTRFS, fsPath ~ " is not a btrfs filesystem"); - auto mounts = getMounts().array; + MountInfo[] mounts; + try + mounts = getMounts().array; + catch (Exception e) {} enforce(fd.isSubvolume, { auto rootPath = mounts.getPathMountInfo(fsPath).file; if (!rootPath)