Added consistent non-empty version output for:

curl --version in packages/bare-os-coreutils/src/curl.js
wget --version in packages/bare-os-coreutils/src/wget.js
openssl version and openssl --version in packages/bare-os-coreutils/src/openssl.js
nano --version (via edit) in packages/bare-os-coreutils/src/edit.js
Updated tar compatibility in packages/bare-os-booter/lib/tar-cli.js:

Added tar --version
Added grouped short-flag parsing (-czf, etc.)
Added first-arg legacy cluster parsing (czf)
Added - archive target support for create/list/extract stream paths
Kept implementation as ustar subset (accepts z for compatibility parsing)
Fixed pipeline/timeout behavior:

Optimized head line mode to stop scanning early (no full split) in packages/bare-os-coreutils/src/head.js
Added bounded safety for yes cap in packages/bare-os-coreutils/src/yes.js
Hardened timeout so timed-out commands reliably produce exit code 124 in packages/bare-os-coreutils/src/timeout.js
Added scoped expr compatibility in shell:

Prevented pathname expansion of bare * only for expr arithmetic-token case in packages/bare-os-booter/lib/shell.js
Added glob option plumbing in packages/bare-os-booter/lib/shell-glob.js
This commit is contained in:
Raven Scott
2026-04-27 08:07:18 -04:00
parent db3aece34d
commit b795397261
32 changed files with 310 additions and 65 deletions
+12 -2
View File
@@ -129,7 +129,12 @@ async function run(ctx, argv) {
24 * 3600 * 1000
)
const ac = new AbortController()
const timer = setTimeout(() => ac.abort(), timeoutMs)
let timedOut = false
const timer = setTimeout(() => {
timedOut = true
ac.abort()
}, timeoutMs)
const priorExit = Number(ctx.exitCode) || 0
try {
if (typeof ctx.runBinCommand !== 'function') {
ctx.console.error('timeout: runBinCommand is not available')
@@ -140,15 +145,20 @@ async function run(ctx, argv) {
signal: ac.signal,
timeoutMs: timeoutMs + 500
})
if (timedOut) {
ctx.exitCode = 124
}
} catch (e) {
const name = e && /** @type {{ name?: string }} */ (e).name
const msg = String((e && e.message) || e || '')
if (name === 'AbortError' || /abort/i.test(msg)) {
if (timedOut || name === 'AbortError' || /abort/i.test(msg)) {
ctx.exitCode = 124
} else {
ctx.exitCode = 1
}
} finally {
clearTimeout(timer)
if (timedOut && ctx.exitCode !== 124) ctx.exitCode = 124
if (!timedOut && ctx.exitCode == null) ctx.exitCode = priorExit
}
}