[
https://issues.apache.org/jira/browse/MESOS-4576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15127138#comment-15127138
]
Jojy Varghese commented on MESOS-4576:
--------------------------------------
Not sure. The choice between *which* and *find* is same as the use case of
these commands on a linux machine. *which* is used when you know the command
and want to find the path to the command in PATH. *find* is used when you want
to search for a file/command in a path.
I think, in the case of SHAxxx, what we need is a combination of which and
find- we want to *find* the first command that looks like
"sha\(512\)\*sum"|"openssl" in a set of Paths ( that could be PATH).
> Introduce a stout helper for "which"
> ------------------------------------
>
> Key: MESOS-4576
> URL: https://issues.apache.org/jira/browse/MESOS-4576
> Project: Mesos
> Issue Type: Improvement
> Components: stout
> Reporter: Joseph Wu
> Labels: mesosphere
>
> We may want to add a helper to {{stout/os.hpp}} that will natively emulate
> the functionality of the Linux utility {{which}}. i.e.
> {code}
> Option<string> which(const string& command)
> {
> Option<string> path = os::getenv("PATH");
> // Loop through path and return the first one which os::exists(...).
> return None();
> }
> {code}
> This helper may be useful:
> * for test filters in {{src/tests/environment.cpp}}
> * a few tests in {{src/tests/containerizer/port_mapping_tests.cpp}}
> * the {{sha512}} utility in {{src/common/command_utils.cpp}}
> * as runtime checks in the {{LogrotateContainerLogger}}
> * etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)