System Info Report
Open as a notebook (.crush-nb, how to run it)
Crush as a conductor: gather facts from the host through capability calls, then
assemble them. The program needs three capability groups, so it is run with
crush run --env --time sysinfo.crush; with either flag missing, the program is
refused before it runs, with the flag it needs (--env: env.get).
// Gather host facts through capabilities and render a small report.
let os = env.os()
let arch = env.arch()
let home = env.get("HOME")
let lines = ["System report", "-------------", "os: " + os, "arch: " + arch]
print(str.join(lines, "\n"))
if home != null {
print("home is set")
}
print("clock ok: " + (time.now() > 0))
System report
-------------
os: linux
arch: x86_64
home is set
clock ok: true
(The os and arch lines depend on the machine that runs the example.)
What this shows:
env.os()/env.arch()(standard library, no flag),env.get(name)(--env, returnsnullwhen the variable is unset),time.now()(--time) — each group is deny-by-defaultstr.join(array, delimiter)to assemble text"label" + (expression)concatenation with aBoolresult- Calls that don’t exist yet: this page used to show
sys.hostname(),sys.cpu_usage(),sys.memory_info()and acapability system readonlydeclaration. None of those exist in the runtime today; host metrics beyondenv.*andtime.*have to come fromprocess.exec(see Build Pipeline) or a polyglot block.