Skip to content

Stop the a11y audit hanging on Windows and auditing a stale preview - #66

Merged
Neaox merged 1 commit into
mainfrom
claude/bold-goldwasser-3a78d7
Sep 23, 2026
Merged

Neaox merged 1 commit into
mainfrom
claude/bold-goldwasser-3a78d7

Conversation

@Neaox

@Neaox Neaox commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

On Windows the audit wrote its report and then never exited, leaving orphaned
astro preview servers on 4331, 4332 and up. startPreview() spawned astro through
run-command.ts, which goes through cmd.exe, and child.kill() ended only the wrapper. The
astro grandchild survived and kept the piped stdout/stderr open, so node stayed alive. One
run sat "running" for three hours at under a second of CPU.

With an orphan on 4331, astro preview quietly moved to the next free port. The script
kept polling 4331 and audited the orphan's older build.

  • astro's own entry point now runs directly under this node, so there is one process to
    stop. On stop, taskkill /T /F on Windows and a process-group kill on POSIX (the child
    is spawned detached) take the whole tree. The pipes are then destroyed and the child
    unref'd. The same kill runs on process exit, SIGINT and SIGTERM.
  • Before spawning, the script fails if anything answers on the port. The base URL comes
    from astro's "Local http://localhost:" line, and a port other than the requested
    one is an error.
  • The browser launch and sitemap read are inside the try, so a failure there still stops
    the preview. The script exits with its exit code once the report is written.

Checked on Windows: npm run build, then A11Y_URLS=/support/ npm run a11y twice in a row.
Each run exited in about 33s with no astro preview left behind; exit code 1 is from the
page's 12 real color-contrast findings. With a server already on 4331, the audit fails in
2s. With the browser launch failing after the preview is up, it exits in 6s and leaves no
preview behind. npm run check passes. The POSIX process-group path was not exercised.

On Windows the audit wrote its report and then never exited, leaving orphaned
`astro preview` servers on 4331, 4332 and up. `startPreview()` spawned astro through
run-command.ts, which goes through cmd.exe, and `child.kill()` ended only the wrapper. The
astro grandchild survived and kept the piped stdout/stderr open, so node stayed alive. One
run sat "running" for three hours at under a second of CPU.

With an orphan on 4331, `astro preview` quietly moved to the next free port. The script
kept polling 4331 and audited the orphan's older build.

- astro's own entry point now runs directly under this node, so there is one process to
  stop. On stop, `taskkill /T /F` on Windows and a process-group kill on POSIX (the child
  is spawned detached) take the whole tree. The pipes are then destroyed and the child
  unref'd. The same kill runs on process exit, SIGINT and SIGTERM.
- Before spawning, the script fails if anything answers on the port. The base URL comes
  from astro's "Local http://localhost:<port>" line, and a port other than the requested
  one is an error.
- The browser launch and sitemap read are inside the try, so a failure there still stops
  the preview. The script exits with its exit code once the report is written.

Checked on Windows: `npm run build`, then `A11Y_URLS=/support/ npm run a11y` twice in a row.
Each run exited in about 33s with no astro preview left behind; exit code 1 is from the
page's 12 real color-contrast findings. With a server already on 4331, the audit fails in
2s. With the browser launch failing after the preview is up, it exits in 6s and leaves no
preview behind. `npm run check` passes. The POSIX process-group path was not exercised.
@Neaox
Neaox merged commit 8bd68cf into main Sep 23, 2026
5 checks passed
@Neaox
Neaox deleted the claude/bold-goldwasser-3a78d7 branch September 23, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant