feat(platform,daemon): isolate executable lookup and report host backends
This commit is contained in:
1 parent
105519924a
commit
9f4477b8d4
10 files changed
+93
-7
No files matched your search
@@ -315,4 +315,17 @@ resolve_confined_path(const std::filesystem::path &root, const std::filesystem::
|
||||
EACCES)};
|
||||
}
|
||||
|
||||
Void::Result::Result<std::filesystem::path, Void::Result::Error> current_executable_path() {
|
||||
std::error_code ec;
|
||||
const auto path = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
if (ec || path.empty()) {
|
||||
return std::unexpected{Void::System::make_system_error(
|
||||
Void::System::SystemErrorCode::io_error,
|
||||
std::format("current_executable_path: cannot resolve /proc/self/exe: {}",
|
||||
ec ? ec.message() : "empty path"),
|
||||
ec.value())};
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace Void::Build::Platform
|
||||
Reference in new issue
Block a user