Skip to content

Commit

Permalink
btdu.main: Fail gracefully when we can't parse /proc/mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Aug 25, 2023
1 parent 474bc73 commit 76b07f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/btdu/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 76b07f9

Please # to comment.