Benjamin Bannier created MESOS-6276:
---------------------------------------
Summary: os::realpath should return a Try<string> instead of
Result<string>
Key: MESOS-6276
URL: https://issues.apache.org/jira/browse/MESOS-6276
Project: Mesos
Issue Type: Bug
Components: stout
Reporter: Benjamin Bannier
Currently {{os::realpath}} returns a {{Result<string>}}. Here the empty case is
used to signify cases where the passed path did not exist (this is a failure
for {{::realpath}}), while all other errors lead to an {{Error}}.
This appears to overload {{os::realpath}} with semantics already present in
{{os::exists}}, and it should be possible to to achieve the current
functionality by filtering inputs to a simpler {{::realpath}} wrapper through
{{os::exists}} -- in fact even with the existing implementation users will need
to check to result of {{os::realpath}} for empty in order to handle
non-existing files. Looking at how the empty case is handled now in the
majority of uses suggests that just propagating the {{::realpath}} error would
be fine and would ensure that by default a good, uniform error message is given
(e.g., {{No such file or directory}}).
{{os::realpath}}'s return type was changed from {{Try<string>}} to
{{Result<string>}} in {{f69eab21808ce9cb2c9cc8290d9d944c5daaaa5d}}, but it does
appear the reasoning given there justifies this change.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)