Merge pull request #4881 from Alexays/copilot/fix-sigabrt-usb-unplug-issue
battery: fix SIGABRT on USB device unplug race condition
This commit is contained in:
@ -139,7 +139,8 @@ void waybar::modules::Battery::refreshBatteries() {
|
||||
auto event_path = (node.path() / "uevent");
|
||||
auto wd = inotify_add_watch(battery_watch_fd_, event_path.c_str(), IN_ACCESS);
|
||||
if (wd < 0) {
|
||||
throw std::runtime_error("Could not watch events for " + node.path().string());
|
||||
spdlog::warn("Could not watch events for {} (device may have been removed)", node.path().string());
|
||||
continue;
|
||||
}
|
||||
batteries_[node.path()] = wd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user