// Child process for the SIGKILL tests. argv: SRC_DIR STEP REQUEST_JSON. // Runs one mutation from the working directory and kills itself with // SIGKILL when the write path reaches STEP (8.5). STEP#N kills at the Nth // time the step is reached: a request's outcome write is its second lock. import { join } from "node:path"; import { pathToFileURL } from "node:url"; const [src, spec, json] = process.argv.slice(2); const [step, nth = "1"] = spec.split("#"); let seen = 0; const store = await import(pathToFileURL(join(src, "store.mjs")).href); store.mutate({ hook: (name) => { if (name === step && ++seen === Number(nth)) process.kill(process.pid, "SIGKILL"); } }, JSON.parse(json)); process.stdout.write("finished without reaching the step\n");