Avoid failure event when deliberately killing events subscriber#2443
Merged
Avoid failure event when deliberately killing events subscriber#2443
failure event when deliberately killing events subscriber#2443Conversation
fredrikekelund
commented
Jan 21, 2026
Comment on lines
+62
to
+71
| const cliSiteEventSchema = z.object( { | ||
| action: z.literal( 'keyValuePair' ), | ||
| key: z.literal( 'site-event' ), | ||
| value: z | ||
| .string() | ||
| .transform( ( val ) => JSON.parse( val ) ) | ||
| .pipe( siteEventSchema ), | ||
| } ); | ||
|
|
||
| let subscriber: ReturnType< typeof executeCliCommand > | null = null; |
Contributor
Author
There was a problem hiding this comment.
I just moved these definitions closer to where they're used
fredrikekelund
commented
Jan 21, 2026
Comment on lines
+113
to
+116
| console.error( | ||
| `Failed to kill child process with pid ${ pid }. This likely means the process is already terminated. CLI args:`, | ||
| args | ||
| ); |
Contributor
Author
There was a problem hiding this comment.
This is unrelated to the core purpose of this PR, but it will help us debug if there's ever an issue with unterminated child processes.
Collaborator
📊 Performance Test ResultsComparing 4294940 vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
Proposed Changes
The CLI
_eventschild process is killed with a SIGKILL signal before the Electron app quits (see #2398 (comment) for background). This triggers afailureevent on theCliCommandEventEmitterinstance, which logs "CLI events subscriber exited unexpectedly" to stdout. This is misleading, because it didn't exit unexpectedly.This PR fixes the problem by removing all event listeners from the
CliCommandEventEmitterinstance before sending the SIGKILL signal.Testing Instructions
npm startsrc/index.ts, for example)CLI events subscriber exited unexpectedlyis logged to stdoutPre-merge Checklist