Files
bare-operating-system/packages/bare-os-coreutils/src/procstat.js
T
Raven Scott 237e0ef63a Added missing locale command support:
packages/bare-os-coreutils/src/locale.js
registered in packages/bare-os-coreutils/lib/commands.mjs
Fixed trustctl generated runtime mismatch:

added preamble wiring in packages/bare-os-coreutils/build.mjs (trustctl: ['p2p-suite.js'])
Improved help behavior:

packages/bare-os-coreutils/src/ssh-keygen.js (help, -h, --help, -?)
packages/bare-os-coreutils/src/oidc-publish.js (help detection across args)
Improved procstat empty-state UX while preserving JSON output:

packages/bare-os-coreutils/src/procstat.js
adds sourcePath and additive hint when process table is empty
Enforced stricter network behavior:

packages/bare-os-coreutils/src/whois.js
prefers ctx.httpFetch, adds bounded timeout via AbortController
clearer timeout/policy/offline error mapping
packages/bare-os-coreutils/src/telnet.js
strict-close behavior by default
--strict-close / --no-strict-close
BARE_OS_TELNET_STRICT_CLOSE env override
Implemented expected-item UX/compat updates:

packages/bare-os-coreutils/src/iconv.js: added -l/--list, improved encoding-pair error messaging
packages/bare-os-coreutils/src/crontab.js: clearer -l empty-file message
packages/bare-os-coreutils/src/getconf.js: added PAGE_SIZE / PAGESIZE aliases
packages/bare-os-coreutils/src/nproc.js: clarified help text
packages/bare-os-coreutils/src/time.js: clarified output comments/behavior
2026-04-27 08:22:57 -04:00

42 lines
943 B
JavaScript

async function run(ctx, argv) {
void argv
let buf = null
try {
buf = await ctx.vfs.readFile('/proc/bare_os/process_table.json')
} catch {
buf = null
}
if (!buf) {
ctx.console.error('procstat: process table unavailable')
ctx.exitCode = 1
return
}
let table
try {
table = JSON.parse(ctx.b4a.toString(buf))
} catch {
ctx.console.error('procstat: invalid process table payload')
ctx.exitCode = 1
return
}
const rows = Array.isArray(table.processes) ? table.processes : []
const emptyHint =
rows.length === 0
? 'process table is empty (provider may be unavailable or no tracked processes)'
: null
ctx.console.log(
JSON.stringify(
{
schema: 1,
atMs: Date.now(),
processCount: rows.length,
sourcePath: '/proc/bare_os/process_table.json',
hint: emptyHint,
processes: rows
},
null,
2
)
)
}