Skip to content

Conversation

@namespacebrian
Copy link
Contributor

@namespacebrian namespacebrian commented Sep 24, 2025

Summary

  • Implement SIGINT (Ctrl+C) and SIGTERM signal handlers for graceful shutdown
  • Add cleanup handler registration system to allow plugins to register cleanup functions
  • Use logger with notice level instead of direct output for better integration
  • Handle cases where pcntl extension is not available

Test plan

  • Test signal handling by running a long command and pressing Ctrl+C
  • Verify cleanup handlers are called when signals are received
  • Test that the application still works when pcntl extension is not available
  • Verify that plugins can register cleanup handlers successfully

Enables pantheon-systems/terminus-repository-plugin#89

- Implement SIGINT and SIGTERM signal handlers using pcntl extension
- Add cleanup handler registration system for plugins
- Use logger with notice level instead of direct output
- Allow plugins to register cleanup handlers via getInstance() and registerCleanupHandler()
- Gracefully handle cases where pcntl extension is not available

🤖 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:34
- Add debug logs when cleanup handlers are registered
- Add debug logs in signal handler showing registered handler count
- Add debug logs during cleanup execution showing each handler call
- Improve error logging with handler index information

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

Co-Authored-By: Claude <[email protected]>
namespacebrian added a commit to pantheon-systems/terminus-repository-plugin that referenced this pull request Sep 24, 2025
- 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]>
- Break long logger->debug() calls into multiple lines to stay under 120 character limit
- Improve code readability while maintaining functionality

🤖 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