fix(macos): scope the app-running check and killall to the current user - #73
Open
Explosion5000 wants to merge 1 commit into
Open
fix(macos): scope the app-running check and killall to the current user#73Explosion5000 wants to merge 1 commit into
Explosion5000 wants to merge 1 commit into
Conversation
On a Mac with several logins (fast user switching) each login runs its own copy of the Stream Deck app against its own ProfilesV3. pgrep -x matched every user's instance, so a write from user A was refused as "could not be stopped" whenever user B's app was up, even though B's instance cannot touch A's profiles and A cannot quit it. Pass -u <uid> to pgrep and killall so only the caller's own instance counts as running or gets stopped.
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.
Problem
On a Mac with more than one login signed in (fast user switching), each login runs its own copy of the Elgato app against its own
ProfilesV3.is_stream_deck_app_running()usespgrep -x "Stream Deck", which matches every user's instance. So astreamdeck_write_pagewithauto_quit_app=Truefrom user A fails with "The Elgato Stream Deck app could not be stopped" whenever user B's app is up: the AppleScript quit andkillallonly reach A's own process, B's keeps running, and the check never clears.B's instance cannot overwrite A's profiles (different home directory), so it should not count.
Fix
Pass
-u <uid>to bothpgrepandkillallso only the caller's own instance is detected or stopped.os.getuid()is used rather than$USERso it holds undersudo -uand launchd.Test
Adds a test asserting the
pgrepinvocation carries-u <current uid>. The real function is bound at import time so the autouse fixture that mocksis_stream_deck_app_runningdoes not short-circuit it. Full suite passes.Reproduced on macOS 26 with two console logins and a Stream Deck +.
🤖 Generated with Claude Code
https://claude.ai/code/session_016A7CesoQLJuJqDtb4benvw