From 7c75b832b27b36949bdafc6374387166a2f1e852 Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Sun, 26 Nov 2023 21:14:15 -0800 Subject: [PATCH] [Teton] Add a barebones way to spawn a process. --- sys/teton/terminal.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/teton/terminal.cpp b/sys/teton/terminal.cpp index 953cc32..992d0ad 100644 --- a/sys/teton/terminal.cpp +++ b/sys/teton/terminal.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include void Terminal::HandleCharacter(char c) { console_.WriteChar(c); @@ -58,6 +60,16 @@ void Terminal::ExecuteCommand(const glcr::String& command) { console_.WriteChar('\n'); } } + } else if (cmd == "exec") { + if (tokens.size() != 2) { + console_.WriteString("Provide the name of an executable.\n>"); + return; + } + auto file = mmth::File::Open(tokens[1]); + + // TODO: Wait until the process exits. + mmth::SpawnProcessFromElfRegion((uint64_t)file.raw_ptr(), gInitEndpointCap); + } else { console_.WriteString("Unknown command: "); console_.WriteString(command);