changeset 373:fbc8c617de80

dep/animone: exception handling is the worst c++ anti-feature
author Paper <paper@tflc.us>
date Fri, 25 Jul 2025 11:03:05 -0400
parents a65a43766b22
children f7bb2978de48
files dep/animone/src/fd/proc.cc
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dep/animone/src/fd/proc.cc	Fri Jul 25 11:02:29 2025 -0400
+++ b/dep/animone/src/fd/proc.cc	Fri Jul 25 11:03:05 2025 -0400
@@ -155,22 +155,27 @@
 	for (const auto& pid : pids) {
 		const std::filesystem::path path = std::filesystem::path(PROC_LOCATION) / std::to_string(pid) / "fd";
 
-		for (const auto& dir : std::filesystem::directory_iterator{path}) {
-			if (!AreFlagsOk(pid, util::StringToInt(dir.path().stem())))
-				continue;
+		try {
+			for (const auto& dir : std::filesystem::directory_iterator{path}) {
+				if (!AreFlagsOk(pid, util::StringToInt(dir.path().stem())))
+					continue;
 
-			std::string name;
-			if (!GetFilenameFromFd(dir.path(), name))
-				continue;
+				std::string name;
+				if (!GetFilenameFromFd(dir.path(), name))
+					continue;
 
-			if (!IsRegularFile(name))
-				continue;
+				if (!IsRegularFile(name))
+					continue;
+
+				if (IsSystemFile(name))
+					continue;
 
-			if (IsSystemFile(name))
-				continue;
-
-			if (!open_file_proc({pid, name}))
-				return false;
+				if (!open_file_proc({pid, name}))
+					return false;
+			}
+		} catch (std::filesystem::filesystem_error &fs_error) {
+			/* I hate C++ */
+			continue;
 		}
 	}
 	return true;