Improve single-instance safety and browser process handling - #1
Open
geovanibruno wants to merge 1 commit into
Open
Improve single-instance safety and browser process handling#1geovanibruno wants to merge 1 commit into
geovanibruno wants to merge 1 commit into
Conversation
Replace command-line-based Python process termination with a native Windows mutex to prevent duplicate instances safely. Deduplicate multi-process applications during each scan and request a graceful browser shutdown before using a bounded forced-termination fallback. Harden auto-start path handling, add mocked process-scanning tests, and document custom targets such as Zen Browser. Tests: python -m unittest discover -s tests -v
geovanibruno
marked this pull request as ready for review
August 15, 2026 23:46
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.
Summary
This pull request improves WinLock's process handling, single-instance
behavior, browser shutdown flow, and compatibility with virtual environments.
Motivation
Browsers commonly run several processes using the same executable name.
Treating each process as a separate protected application can cause duplicate
lock screens during the same monitoring cycle.
The previous single-instance implementation also searched for and terminated
Python processes based on their command line. In virtual environments, the
launcher and runtime may appear as separate Python processes, which can cause
WinLock to terminate its own active instance.
Finally, immediately killing every browser process can make browsers interpret
Cancel as an unexpected shutdown and display crash-recovery or troubleshooting
prompts on the next launch.
Changes
mutex.
scan.
WM_CLOSEbefore using a boundedforced-termination fallback.
psutilprocess-access errorsexplicitly.
including virtual-environment installations.
Compatibility
1234.is not enabled by default.
Testing
Result:
The tests use simulated process information and do not start or terminate real
browsers.
Licensing note
The repository currently does not include an explicit license. No license is
added in this pull request because that choice should be made by the original
copyright holder.