[STAB-851] fix debug-coredump.ts (#21318)

This commit is contained in:
190n
2025-07-23 12:23:14 -07:00
committed by GitHub
parent 71e2161591
commit ace81813fc

View File

@@ -44,17 +44,21 @@ if (!fs.existsSync(join(dir, "bun-profile")) || !fs.existsSync(join(dir, `bun-${
await Bun.$`bash -c ${`age -d -i <(echo "$AGE_CORES_IDENTITY")`} < ${cores} | tar -zxvC ${dir}`; await Bun.$`bash -c ${`age -d -i <(echo "$AGE_CORES_IDENTITY")`} < ${cores} | tar -zxvC ${dir}`;
console.log("moving cores out of nested directory"); console.log("moving cores out of nested directory");
for await (const file of new Bun.Glob("bun-cores-*/bun-*.core").scan(dir)) { for await (const file of new Bun.Glob("bun-cores-*/*.core").scan(dir)) {
fs.renameSync(join(dir, file), join(dir, basename(file))); fs.renameSync(join(dir, file), join(dir, basename(file)));
} }
} else { } else {
console.log(`already downloaded in ${dir}`); console.log(`already downloaded in ${dir}`);
} }
console.log("launching debugger:"); const desiredCore = join(dir, (await new Bun.Glob(`*${pid}.core`).scan(dir).next()).value);
console.log(`${debuggerPath} --core ${join(dir, `bun-${pid}.core`)} ${join(dir, "bun-profile")}`);
const proc = await Bun.spawn([debuggerPath, "--core", join(dir, `bun-${pid}.core`), join(dir, "bun-profile")], { const args = [debuggerPath, "--core", desiredCore, join(dir, "bun-profile")];
console.log("launching debugger:");
console.log(args.map(Bun.$.escape).join(" "));
const proc = Bun.spawn(args, {
stdin: "inherit", stdin: "inherit",
stdout: "inherit", stdout: "inherit",
stderr: "inherit", stderr: "inherit",