[Teton] Duplicate yellowstone cap before spawning processes.

This commit is contained in:
Drew Galbraith 2023-12-07 00:18:09 -08:00
parent ebe72af716
commit 961389dee8
1 changed files with 8 additions and 3 deletions

View File

@ -68,9 +68,14 @@ void Terminal::ExecuteCommand(const glcr::String& command) {
} }
auto file = mmth::File::Open(tokens[1]); auto file = mmth::File::Open(tokens[1]);
// TODO: Wait until the process exits. z_cap_t endpoint;
auto error_or_cap = mmth::SpawnProcessFromElfRegion( if (ZCapDuplicate(gInitEndpointCap, kZionPerm_All, &endpoint) != glcr::OK) {
(uint64_t)file.raw_ptr(), gInitEndpointCap); console_.WriteString("Couldn't duplicate yellowstone cap for spawn");
return;
}
auto error_or_cap =
mmth::SpawnProcessFromElfRegion((uint64_t)file.raw_ptr(), endpoint);
if (!error_or_cap.ok()) { if (!error_or_cap.ok()) {
console_.WriteString( console_.WriteString(
glcr::StrFormat("Error: {}\n", error_or_cap.error())); glcr::StrFormat("Error: {}\n", error_or_cap.error()));