fix(sdk): ensure process exits after SIGTERM signal handling#1435
fix(sdk): ensure process exits after SIGTERM signal handling#1435yifancong merged 3 commits intoweb-infra-dev:mainfrom
Conversation
When SIGTERM is received, the dispose method was called but the process did not exit, causing rstest to wait indefinitely and eventually kill the process with SIGKILL, preventing proper test result collection. Changes: - Add shouldExit parameter to dispose method (default: false) - Call process.exit(0) after cleanup when shouldExit is true - Update signal handlers (SIGTERM, SIGINT, unhandledRejection, uncaughtException) to pass shouldExit: true - Keep exit event handler with shouldExit: false to avoid double exit - Manual dispose() calls in tests remain unaffected (default shouldExit: false) This ensures that when rstest sends SIGTERM, the process properly exits after cleanup, allowing rstest to collect test results normally.
✅ Deploy Preview for rsdoctor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address review feedback: unhandledRejection and uncaughtException should exit with non-zero status code (1) instead of 0, so CI/rstest can properly detect failures and collect error information. Changes: - Change dispose parameter from shouldExit: boolean to exitCode?: number - SIGTERM and SIGINT exit with code 0 (normal termination) - unhandledRejection and uncaughtException exit with code 1 (error) - exit event handler doesn't pass exitCode (process already exiting)
|
This now silently kills the webpack build process (when @rsdoctor/webpack-plugin) is used on any uncaught exception. |
|
https://nodejs.org/api/process.html#event-uncaughtexception by default node already kills the process, however, the default also prints the error stack. so the handler in rsdoctor should simply be removed |
When SIGTERM is received, the dispose method was called but the process did not exit, causing rstest to wait indefinitely and eventually kill the process with SIGKILL, preventing proper test result collection.
Changes:
This ensures that when rstest sends SIGTERM, the process properly exits after cleanup, allowing rstest to collect test results normally.