Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions config/scripts/runtime-file-watcher-fault-harness.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ async function loadSupervisor(bundleDir) {
return require(outfile).WatcherProcessSupervisor
}

// Why: release cuts run this harness from older tags too; #24863 moved the child and canary into `slot`.
function watcherSlot(supervisor) {
return supervisor.slot ?? supervisor
}

async function main() {
if (process.platform === 'win32') {
console.log('[runtime-file-watcher-fault] SKIP: SIGSEGV oracle is macOS/Linux only')
Expand Down Expand Up @@ -115,7 +120,7 @@ async function main() {
onInterruption: () => resolveInterruption()
}
)
watcherCanaryDir = supervisor.canaryDir
watcherCanaryDir = watcherSlot(supervisor).canaryDir

const beforeEvent = nextMatchingEvent(
(listener) => {
Expand All @@ -127,14 +132,14 @@ async function main() {
await writeFile(join(rootPath, 'before.txt'), 'before')
await Promise.race([beforeEvent, watcherError])

const firstChildPid = supervisor.child?.pid
const firstChildPid = watcherSlot(supervisor).child?.pid
if (!firstChildPid) {
throw new Error('Watcher supervisor did not expose a live child')
}
process.kill(firstChildPid, 'SIGSEGV')
await Promise.race([interrupted, watcherError])

const replacementChildPid = supervisor.child?.pid
const replacementChildPid = watcherSlot(supervisor).child?.pid
if (!replacementChildPid || replacementChildPid === firstChildPid) {
throw new Error('Watcher supervisor did not replace the faulted child')
}
Expand Down
Loading