You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR contains a simple patch to terminate the plugin process when the WebSocket connection to Stream Deck closes. This ensures that if Stream Deck wasn't able to terminate the plugin process cleanly on exit (e.g. due to Stream Deck being SIGKILLed), it will terminate itself automatically when the WebSocket server is no longer reachable.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Hi @nekename, I've confirmed with the Stream Deck Core team, and they don't have any concerns (regarding the connection / process management) with this being added — once the tests are fixed, we'll be happy to merge this in.
Thanks. I'm not too familiar with what's happening with the tests: should I just skip process.exit() when running in the mock environment, so that it has time to call the listeners that it says aren't being called before the mock server dies? How do I detect when it's running in the mock environment?
I believe the issue is the new process.exit() is preventing an assertion happening within a test, which is causing the test suite to mark the test as invalid — as a fix, you should be able to stub process.exit() to prevent exiting within connection.test.ts, specifically within the beforeEach call, e.g.
// Re-import the connection to ensure a fresh state.
beforeEach(async () => {
+ // @ts-expect-error: prevent process.exit() from exiting+ vi.spyOn(process, "exit").mockImplementation(() => {+ /* no-op */+ });
//...
});
The latest changes look good — there are some open discussions internally before we're 100% confident with merging this in. I'll keep you posted as they progress.
Thanks. I believe this should be fine as plugin SDKs in native languages like C# or Rust tend to (some work otherwise) block on a receive loop from the WebSocket on the main thread, meaning the program exits once the WebSocket is closed.
Thanks for your patience @nekename. After some discussion internally, we'd like to make a few additions to this before it lands in main; could I ask you to re-submit a PR to websocket-onclose please so we can make the additions.
If you need to make any changes, I've left 'Allow edits from maintainers' enabled on this PR, so you should be able to just push to my branch. If you still need me to reopen this against websocket-onclose let me know
That's even better, thank you — please ignore the websocket-onclose branch, we'll push changes to the fork.
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
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.
Hello!
This PR contains a simple patch to terminate the plugin process when the WebSocket connection to Stream Deck closes. This ensures that if Stream Deck wasn't able to terminate the plugin process cleanly on exit (e.g. due to Stream Deck being SIGKILLed), it will terminate itself automatically when the WebSocket server is no longer reachable.
Thanks :)