Skip to content

Allow CTRL-C interruption of profile command + macro debug logs#1206

Open
lekemula wants to merge 2 commits into
castwide:masterfrom
lekemula:lm-profile-command-interrupt
Open

Allow CTRL-C interruption of profile command + macro debug logs#1206
lekemula wants to merge 2 commits into
castwide:masterfrom
lekemula:lm-profile-command-interrupt

Conversation

@lekemula
Copy link
Copy Markdown
Contributor

@lekemula lekemula commented May 29, 2026

Summary

Two small developer-experience changes that came out of profiling YARD macro processing for the comment at #1194 (comment):

  • solargraph profile: trap SIGINT and rescue Interrupt so a long-running phase can be aborted with CTRL-C and the in-progress Vernier profile is still written via its ensure clause. The summary now reports only the phases that actually completed and lists the profile files that exist on disk. A second CTRL-C restores default handling for a hard exit.
  • ApiMap#process_macros: add a few Solargraph.logger.debug { ... } lines around macro processing (source-map count, store macro counts, per-file candidate counts). Used while gathering the data behind the linked comment.

Context

These changes were used to produce the profiling/log data referenced in the comment on PR #1194 (YARD macros). The profile-command change in particular was needed because some phases of solargraph profile can run for a long time on large workspaces, and without trapping CTRL-C the partial Vernier output was lost.

Test plan

  • solargraph profile -d <workspace> finishes normally and writes the three *_benchmark.json.gz files as before.
  • Pressing CTRL-C once during a phase: the script prints an "Interrupted" message, the current Vernier.profile block unwinds through its ensure and writes its output file, the summary lists timings for completed phases only, and the script exits cleanly (no stack trace).
  • Pressing CTRL-C a second time during the same phase exits immediately via default INT handling.
  • Debug logs only appear when SOLARGRAPH_LOG=debug is set (default is warn), so default users see no change.

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