Phase 5: Ausführung und Output implementieren und archivieren

This commit is contained in:
2026-09-06 18:56:47 +02:00
parent 9c85349a4d
commit e3dc9028bf
37 changed files with 2404 additions and 450 deletions

View File

@@ -158,6 +158,15 @@ pub mod taste {
}
pub trait Host {
/// None means the frontend has scheduled a terminal handoff; retry the
/// same request after it supplies the child result.
fn shell(&mut self, command: &str) -> Result<Option<i32>, crate::errors::RuntimeError> {
shell_command(command)
.status()
.map(|s| Some(s.code().unwrap_or(0)))
.map_err(|_| crate::errors::RuntimeError(53))
}
/// Aktuellen Bildschirmzustand anzeigen.
fn present(&mut self, screen: &TextScreen);
@@ -388,3 +397,12 @@ mod tests {
assert_eq!(h.next_event(false), None);
}
}
/// Shared child command, inheriting the foreground terminal and stdio.
pub fn shell_command(command: &str) -> std::process::Command {
let mut child = std::process::Command::new(if cfg!(windows) { "cmd" } else { "sh" });
if !command.is_empty() {
child.args([if cfg!(windows) { "/C" } else { "-c" }, command]);
}
child
}