18 lines
547 B
Plaintext
18 lines
547 B
Plaintext
/** Shared helpers for drive-resident /bin scripts (prepended before each command). */
|
|
function bareStdin(ctx) {
|
|
return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : ''
|
|
}
|
|
|
|
/** Drive-resident exit: ends the booter session (ctx.requestBooterExit from bare-os-booter). */
|
|
async function run(ctx, argv) {
|
|
let ec = 0
|
|
if (argv[1] !== undefined) {
|
|
const n = Number.parseInt(argv[1], 10)
|
|
ec = Number.isFinite(n) ? n : 0
|
|
}
|
|
if (typeof ctx.requestBooterExit === 'function') {
|
|
ctx.requestBooterExit(ec)
|
|
}
|
|
ctx.exitCode = ec
|
|
}
|