Skip to content

Conversation

@namespacebrian
Copy link
Contributor

@namespacebrian namespacebrian commented Sep 24, 2025

Summary

  • Register cleanup handler with Terminus core when site is created
  • Fix broken cleanup() method call to use cleanupPantheonSite()
  • Add debug logging for cleanup handler registration and execution
  • Ensure sites are properly cleaned up when interrupted by SIGINT/SIGTERM

Dependencies

⚠️ This PR depends on pantheon-systems/terminus#2731 being merged first.

The terminus-core PR adds the signal handling infrastructure that this plugin integrates with. Without that PR, the registerCleanupHandler() method and getInstance() static method won't be available.

How it works

  1. When a site is successfully created, the plugin registers a cleanup handler with the core Terminus instance
  2. If the user presses Ctrl+C (SIGINT) or the process receives SIGTERM, the core signal handler calls all registered cleanup handlers
  3. The plugin's cleanup handler calls cleanupPantheonSite() to delete the partially created site and clean up VCS records

Test plan

  • Verify the plugin builds and loads without the core PR (should work but cleanup won't register)
  • Test with the core PR: run site:create and press Ctrl+C during creation
  • Verify the site gets cleaned up properly when interrupted
  • Check debug logs show the cleanup handler registration and execution

- Register cleanup handler with Terminus core when site is created
- Fix broken cleanup() method call to use cleanupPantheonSite()
- Add debug logging for cleanup handler registration and execution
- Ensure sites are properly cleaned up when interrupted by SIGINT/SIGTERM

Depends on: pantheon-systems/terminus#2731

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@namespacebrian namespacebrian requested a review from a team as a code owner September 24, 2025 19:54
namespacebrian and others added 2 commits September 24, 2025 16:09
- Check if getInstance() and registerCleanupHandler() methods exist before using
- Gracefully handle cases where Terminus core doesn't have signal handling support
- Change error to debug log when signal handling is not available for better CI compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

2 participants