From 6bfdddd0b53ac4c3d1583bcfbff99cd0d2b91cb1 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 25 Mar 2021 15:15:45 +0100 Subject: [PATCH] fs_query: gracefully deal with missing directories The fs_query component used to exit with an uncaught exception if a queried directory didn't exist. Now, fs_query will catch this event and simply skip the affected query, thereby indicating to the user the inexistence of the queried directory. Ref #4032 --- repos/gems/run/fs_query.run | 15 +++++++++++++++ repos/gems/src/app/fs_query/main.cc | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/repos/gems/run/fs_query.run b/repos/gems/run/fs_query.run index 791e3cbc48..c928de15e3 100644 --- a/repos/gems/run/fs_query.run +++ b/repos/gems/run/fs_query.run @@ -81,7 +81,9 @@ install_config { + + @@ -154,6 +156,19 @@ install_config { + + + + + + + + + + + + + diff --git a/repos/gems/src/app/fs_query/main.cc b/repos/gems/src/app/fs_query/main.cc index a1a4592668..492933de4e 100644 --- a/repos/gems/src/app/fs_query/main.cc +++ b/repos/gems/src/app/fs_query/main.cc @@ -234,7 +234,12 @@ struct Fs_query::Main : Vfs::Watch_response_handler config.for_each_sub_node("query", [&] (Xml_node query) { Directory::Path const path = query.attribute_value("path", Directory::Path()); - new (_heap) Registered(_dirs, _heap, _root_dir, path, *this); + try { + new (_heap) + Registered( + _dirs, _heap, _root_dir, path, *this); + } + catch (Genode::Directory::Nonexistent_directory) { } }); _reporter.generate([&] (Xml_generator &xml) {