@@ -0,0 +1,17 @@
|
||||
/** 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
|
||||
}
|
||||
+1
-1
@@ -5,6 +5,6 @@ function bareStdin(ctx) {
|
||||
|
||||
async function run(ctx, argv) {
|
||||
ctx.console.log(
|
||||
'Bare OS — builtins: cd, export, exit, quit | /bin: basename cat clear date dirname echo env false head help hostname id ls nl pathchk printenv pwd rm seq sleep sort tail test touch true tty uname wc which whoami'
|
||||
'Bare OS — builtins: cd, export, exit | /bin: basename cat clear date dirname echo env exit false head help hostname id ls nl pathchk printenv pwd rm seq sleep sort tail test touch true tty uname wc which whoami'
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ async function start(ctx) {
|
||||
const rel = await drive.get('/etc/os-release')
|
||||
if (rel) console.log(b4a.toString(rel))
|
||||
console.log(
|
||||
'Bare operating system — POSIX-ish shell: cd, export, exit, quit | try: help, ls /bin, pwd'
|
||||
'Bare operating system — POSIX-ish shell: cd, export, exit | try: help, ls /bin, pwd'
|
||||
)
|
||||
while (true) {
|
||||
const line = await readLine('bare-os> ')
|
||||
const line = await readLine('')
|
||||
if (line == null) break
|
||||
const t = line.trim()
|
||||
if (t === '') continue
|
||||
|
||||
Reference in New Issue
Block a user