From ace81813fccd479992323b8b180654345a0cdcff Mon Sep 17 00:00:00 2001 From: 190n Date: Wed, 23 Jul 2025 12:23:14 -0700 Subject: [PATCH] [STAB-851] fix debug-coredump.ts (#21318) --- scripts/debug-coredump.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/debug-coredump.ts b/scripts/debug-coredump.ts index 625afb727a..b2b04744eb 100644 --- a/scripts/debug-coredump.ts +++ b/scripts/debug-coredump.ts @@ -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}`; 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))); } } else { console.log(`already downloaded in ${dir}`); } -console.log("launching debugger:"); -console.log(`${debuggerPath} --core ${join(dir, `bun-${pid}.core`)} ${join(dir, "bun-profile")}`); +const desiredCore = join(dir, (await new Bun.Glob(`*${pid}.core`).scan(dir).next()).value); -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", stdout: "inherit", stderr: "inherit",