fake worker: the OpenCL listing carries the real worker's header line, so the engine reads an answered enumeration and removes a card that left

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit ecd798747a26d339ff514da04773be858780636c)
This commit is contained in:
igneum-labs 2026-10-07 12:27:44 +00:00
parent ced26986fd
commit cb8a265431

View file

@ -29,6 +29,9 @@ import { createInterface } from 'node:readline';
if (process.argv.includes('--list')) {
const m = (() => { try { return require('node:fs').readFileSync(process.env.FAKE_WORKER_CTL, 'utf8').trim().split(/\s+/)[0]; } catch { return 'ok'; } })();
const n = m === 'absent' ? 0 : (() => { try { const l = require('node:fs').readFileSync(process.env.FAKE_WORKER_CTL, 'utf8').split('\n').map(x => x.trim().split(/\s+/)).find(f => f[0] === 'devices'); return l ? Number(l[1]) : 1; } catch { return 1; } })();
// the real worker's header line: the engine reads a listing without it as "the tool did not answer" and removes
// no card on it (src/detect.rs parse_opencl_list), which is right for a crashed driver and wrong for a stand-in
process.stdout.write(`OpenCL devices (${n}):\n`);
for (let i = 0; i < n; i++) {
process.stdout.write(`[${i}] Fake GPU ${i + 1} | Fake Platform (OpenCL 1.2)\n GPU, vendor Fake Silicon, driver 1.0.0, OpenCL C 1.2, 8 compute units, 8192 MB\n`);
}