Fixed command substitution behavior in shell expansion:

packages/bare-os-booter/lib/shell.js
$(...)/backticks are now enabled by default unless explicitly disabled via BARE_OS_SHELL_CMDSUBST=0|false|off.
Fixed sh -c exit/status propagation:

packages/bare-os-booter/lib/shell.js
Syncs BARE_OS_EXIT_STATUS after each executed statement so later commands in the same line (like echo $?) see the immediately previous status.
packages/bare-os-coreutils/src/sh.js
In -c mode, reads final BARE_OS_EXIT_STATUS back into ctx.exitCode for consistent result propagation.
Implemented trap behavior for requested scope (EXIT, INT, TERM):

packages/bare-os-booter/lib/shell.js
exit builtin now runs EXIT trap handler before requesting booter exit.
packages/bare-os-booter/index.js
Signal delivery for shell PID now triggers trap dispatch for INT/TERM.
Hardened ulimit -f invalid diagnostics:

packages/bare-os-coreutils/src/ulimit.js
Explicit invalid-value error for malformed -f setter input, with nonzero exit.
Supported-but-unimplemented setter values still return explicit unsupported-setter error.
This commit is contained in:
Raven Scott
2026-04-27 08:41:43 -04:00
parent dd5890b98c
commit d5535cdb65
17 changed files with 117 additions and 10 deletions
+3
View File
@@ -62,6 +62,9 @@ async function run(ctx, argv) {
}
try {
await ctx.execLine(command)
const v = ctx.vfs?.env?.BARE_OS_EXIT_STATUS
const n = Number.parseInt(String(v ?? ''), 10)
if (Number.isFinite(n)) ctx.exitCode = n
} finally {
if (saved && env) {
for (const [k, v] of Object.entries(saved)) {