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 ) ) }