Skip to content

Commit 9588c40

Browse files
Merge pull request #33 from daijro/main
Fix the empty process list issue on non rooted android devices
2 parents 7e9eb5e + 52fa864 commit 9588c40

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

taskmanagerd/src/main/cpp/taskmanagerd.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ std::vector<int> listPids() {
3535
std::vector<int> pids;
3636
pids.reserve(256);
3737

38-
try {
39-
for (const auto &entry : fs::directory_iterator("/proc")) {
38+
for (const auto &entry : fs::directory_iterator("/proc")) {
39+
// Fix to move the try catch block inside the loop
40+
try {
4041
if (entry.is_directory()) {
4142
std::string name = entry.path().filename();
4243
if (std::regex_match(name, pid_regex)) {
4344
pids.push_back(std::stoi(name));
4445
}
4546
}
47+
} catch (...) {
48+
4649
}
47-
} catch (...) {
48-
4950
}
5051
return pids;
5152
}

0 commit comments

Comments
 (0)