mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
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
This commit is contained in:
parent
026b117a63
commit
6bfdddd0b5
@ -81,7 +81,9 @@ install_config {
|
|||||||
<resource name="RAM" quantum="2M"/>
|
<resource name="RAM" quantum="2M"/>
|
||||||
<config>
|
<config>
|
||||||
<vfs> <dir name="fs"> <fs writeable="yes"/> </dir> </vfs>
|
<vfs> <dir name="fs"> <fs writeable="yes"/> </dir> </vfs>
|
||||||
|
<query path="/fs/items/non_existent_1"/>
|
||||||
<query path="/fs/items" content="yes"/>
|
<query path="/fs/items" content="yes"/>
|
||||||
|
<query path="/fs/non_existent_2" content="yes"/>
|
||||||
</config>
|
</config>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
@ -154,6 +156,19 @@ install_config {
|
|||||||
</config>
|
</config>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
|
<start name="/bin/bash" caps="500">
|
||||||
|
<config>
|
||||||
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" rtc="/dev/null"/>
|
||||||
|
<vfs>
|
||||||
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
||||||
|
<dir name="dev"> <log/> <null/> </dir>
|
||||||
|
</vfs>
|
||||||
|
<arg value="/bin/bash"/>
|
||||||
|
<arg value="-c"/>
|
||||||
|
<arg value="echo updated > /fs/items/3"/>
|
||||||
|
</config>
|
||||||
|
</start>
|
||||||
|
|
||||||
<start name="/bin/sleep" caps="500">
|
<start name="/bin/sleep" caps="500">
|
||||||
<config>
|
<config>
|
||||||
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
||||||
|
@ -234,7 +234,12 @@ struct Fs_query::Main : Vfs::Watch_response_handler
|
|||||||
|
|
||||||
config.for_each_sub_node("query", [&] (Xml_node query) {
|
config.for_each_sub_node("query", [&] (Xml_node query) {
|
||||||
Directory::Path const path = query.attribute_value("path", Directory::Path());
|
Directory::Path const path = query.attribute_value("path", Directory::Path());
|
||||||
new (_heap) Registered<Watched_directory>(_dirs, _heap, _root_dir, path, *this);
|
try {
|
||||||
|
new (_heap)
|
||||||
|
Registered<Watched_directory>(
|
||||||
|
_dirs, _heap, _root_dir, path, *this);
|
||||||
|
}
|
||||||
|
catch (Genode::Directory::Nonexistent_directory) { }
|
||||||
});
|
});
|
||||||
|
|
||||||
_reporter.generate([&] (Xml_generator &xml) {
|
_reporter.generate([&] (Xml_generator &xml) {
|
||||||
|
Loading…
Reference in New Issue
Block a user