Core error propagation hardening:
Updated kernel-runner delegate deny path to emit on stderr in packages/bare-os-booter/lib/kernel-runner.js. Added structured errno metadata (err.code) via vfsErr(...) and applied it to key VFS traversal/permission throws in packages/bare-os-booter/lib/vfs.js (ENOENT/EACCES paths). Critical command exit-code fixes: packages/bare-os-coreutils/src/ls.js Tracks access/stat failures and sets nonzero exit when any operand fails. packages/bare-os-coreutils/src/grep.js Recursive walker now reports traversal/stat errors back to main flow so fatal status becomes 2. packages/bare-os-coreutils/src/rm.js -f only suppresses not-found style errors; permission/deny failures stay nonzero. packages/bare-os-coreutils/src/chmod.js Treats falsy/no-op backend chmod result as failure (nonzero). packages/bare-os-coreutils/src/find.js Added root-path preflight so missing root now reports explicit error + nonzero. Minor quirks: packages/bare-os-coreutils/src/xargs.js -P0 now maps to bounded parallel cap (env/default cap), not forced serial. packages/bare-os-coreutils/src/ulimit.js -f with value now returns explicit unsupported-setter diagnostic + nonzero. -f alone reports unlimited. Regression tests: Added packages/bare-os-coreutils/test/error-propagation.test.mjs covering: grep missing file => exit 2 rm -f permission error => nonzero find missing root => nonzero + diagnostic ulimit -f 1M => explicit unsupported + nonzero xargs -P0 bounded behavior
This commit is contained in:
+5
-1
@@ -153,7 +153,11 @@ async function run(ctx, argv) {
|
||||
}
|
||||
perm &= 0o777
|
||||
}
|
||||
await ctx.vfs.chmod(f, perm)
|
||||
const r = await ctx.vfs.chmod(f, perm)
|
||||
if (r === false || r == null) {
|
||||
ctx.console.error('chmod: ' + f + ': Operation failed')
|
||||
ctx.exitCode = 1
|
||||
}
|
||||
} catch (e) {
|
||||
ctx.console.error('chmod: ' + f + ': ' + (e.message || e))
|
||||
ctx.exitCode = 1
|
||||
|
||||
Reference in New Issue
Block a user