Skip to content

Single-instance lock: catch only BlockingIOError and PermissionError - #1

Closed
TomHolzknecht wants to merge 4 commits into
winidi:mainfrom
TomHolzknecht:fix-windows-gui-start
Closed

TomHolzknecht wants to merge 4 commits into
winidi:mainfrom
TomHolzknecht:fix-windows-gui-start

Conversation

@TomHolzknecht

@TomHolzknecht TomHolzknecht commented Oct 5, 2026 •

Copy link
Copy Markdown

origin/main now has its own Windows support (commit 1faf9e2), including the msvcrt lock that this PR first added. After merging main into this branch, one change is left.

The single-instance lock caught every OSError and then reported "already running". An unwritable config folder gave the same misleading result. Now it catches only the two lock-held errors:

  • BlockingIOError from flock on Linux and macOS
  • PermissionError from msvcrt.locking on Windows (errno 13)

Other OSErrors propagate.

Tested on Windows 11 with two processes: the first instance gets the lock, the second is refused, and a third gets it after the first ends. Not run on Linux or macOS.

🤖 Generated with Claude Code

TomHolzknecht and others added 2 commits October 5, 2026 15:52
fcntl exists only on Linux and macOS. Import it inside the single-instance
lock function and use msvcrt.locking on Windows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Without sherpa-onnx the GUI shows "No module named 'sherpa_onnx'" when the
Local provider is selected.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The lock code caught every OSError and reported "Dictate is already running".
An unwritable config folder gave the same misleading message. Now only the
two lock-held errors count: BlockingIOError (flock on Linux/macOS) and
PermissionError (msvcrt.locking on Windows). Other OSErrors propagate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
origin/main now has its own Windows support, including the msvcrt lock.
Resolved: take main's docstring, core.IS_WINDOWS and README line. Keep this
PR's one remaining change: the lock catches only BlockingIOError and
PermissionError instead of every OSError.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@TomHolzknecht TomHolzknecht changed the title Fix GUI start on Windows: lock file without fcntl Single-instance lock: catch only BlockingIOError and PermissionError Oct 16, 2026
@TomHolzknecht

Copy link
Copy Markdown
Author

Thanks for the updates, I close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant