// Row 54 (#1543): the Console's read of the queue, run as a child with its // cwd at the checkout so one slow read never stalls the HTTP server. It // calls rows() in packages/queue (lead decision 83): the same unlocked read // as `queue list`, which writes nothing. JSON on stdout; a refusal's message // on stderr with the store's exit code. // // The store is imported inside the try, so a store.mjs that fails to load // (a half-written file in a shared checkout) prints "the queue read failed", // never Node's own message, which names the file:// path and a stack. let QueueError = null; try { ({ QueueError } = await import('../../queue/src/errors.mjs')); const { rows } = await import('../../queue/src/store.mjs'); const r = rows({}); process.stdout.write(`${JSON.stringify({ rows: r.rows, notes: r.err })}\n`); } catch (err) { const refused = QueueError !== null && err instanceof QueueError; process.stderr.write(`${refused ? err.message : 'the queue read failed'}\n`); process.exitCode = refused && Number.isInteger(err.code) && err.code > 0 ? err.code : 1; }