Use execvpe instead of execve in omnitrace-sample (#187)
* Use execvpe instead of execve in omnitrace-sample - previous implementation preferred exe in PATH over exe in PWD - 'p' variants of exec duplicate the actions of the shell in searching for an executable file if the specified filename does not contain a slash character * OpenMPI oversubscribe arg in testing
Αυτή η υποβολή περιλαμβάνεται σε:
υποβλήθηκε από
GitHub
γονέας
a41a5c155e
υποβολή
139070a2de
@@ -64,12 +64,6 @@ auto updated_envs = std::set<std::string_view>{};
|
||||
auto original_envs = std::set<std::string>{};
|
||||
} // namespace
|
||||
|
||||
std::string
|
||||
get_command(const char* _argv0)
|
||||
{
|
||||
return omnitrace::path::find_path(_argv0, 0, omnitrace::common::get_env("PATH", ""));
|
||||
}
|
||||
|
||||
std::string
|
||||
get_realpath(const std::string& _v)
|
||||
{
|
||||
|
||||
@@ -56,11 +56,10 @@ main(int argc, char** argv)
|
||||
|
||||
if(!_argv.empty())
|
||||
{
|
||||
std::string _argv0 = get_command(_argv[0]);
|
||||
print_command(_argv);
|
||||
_argv.emplace_back(nullptr);
|
||||
_env.emplace_back(nullptr);
|
||||
|
||||
return execve(_argv0.c_str(), _argv.data(), _env.data());
|
||||
return execvpe(_argv.front(), _argv.data(), _env.data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
std::string
|
||||
get_command(const char*);
|
||||
|
||||
std::string
|
||||
get_realpath(const std::string&);
|
||||
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user