// Child process for the lock tests. argv: GITDIR MODE // kill-before-link SIGKILL itself after the temp record is written // hold take the lock, print "held", then wait to be killed import { realIo, sleepMs } from "../../src/io.mjs"; import { acquire } from "../../src/lock.mjs"; const [gitDir, mode] = process.argv.slice(2); if (mode === "kill-before-link") { acquire({ gitDir, io: realIo, verb: "move", hook: (n) => { if (n === "lock-temp-written") process.kill(process.pid, "SIGKILL"); } }); } else if (mode === "hold") { acquire({ gitDir, io: realIo, op: "holder-op-1", verb: "move" }); process.stdout.write("held\n"); sleepMs(60000); }