Expand description
A program with the screen and the keyboard to itself while it runs: an app.
An app is a utility (crate::program) that, for as long as it runs, OWNS the console: what it prints is the
screen, and the keys typed are its, not the shell’s. When it ends - by App::close, or by dying - the
console goes back to the shell, which draws a fresh prompt. That is the mechanism the built-in full-screen
tools (chaos, observe) already use: the console foreground (syscall 40), released by the kernel when its
holder dies, so a crashed app cannot take the keyboard with it.
use godspeed::{self as gs, ServiceContext};
#[allow(unsafe_code)]
#[no_mangle]
pub extern "C" fn service_main(ctx: ServiceContext) -> ! {
let mut buf = [0u8; gs::program::ARGS_MAX];
let _args = gs::program::args(&ctx, &mut buf);
let app = gs::app::App::open(&ctx);
app.println("hello - press any key");
let _ = app.wait_key();
app.close(0)
}What it is given to do this: the console, which the operator approves at godspeed install - “it reads
the keyboard while it runs” - because keystrokes are commands (CLAUDE.md 6.4, SEC-2). Nothing else.
Structs§
- App
- The console, held by this program until
App::close.