Repository navigation
fix(pflash): support Windows in DflashClient - #126
Merged
Merged
Conversation
The daemon-spawn path was POSIX-only. Three things break on Windows: 1. `LD_LIBRARY_PATH` is meaningless; Windows uses `PATH` for DLL resolution. 2. `subprocess.Popen(pass_fds=...)` is unsupported on Windows. 3. The child receives the parent file descriptor via `--stream-fd`, which on Windows must be a Win32 HANDLE (an `int`-castable handle value), not a CRT fd integer. Fixes: - Add a `sys.platform == "win32"` branch when extending the loader search path. The `else` branch is unchanged, so Linux behaviour is byte-identical to before. - On Windows, mark the pipe write-end inheritable (`os.set_inheritable`) and pass `msvcrt.get_osfhandle(...)` as `--stream-fd`. The daemon already accepts a HANDLE value here on Windows. - On Windows, spawn with `close_fds=False` so the child inherits the marked handle; on POSIX, keep the existing `pass_fds=(self.w_pipe,)` path. The pattern matches the in-process port already used in `dflash/scripts/server.py`.
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pflash/pflash/dflash_client.py">
<violation number="1" location="pflash/pflash/dflash_client.py:68">
P1: Windows HANDLE values are passed through `--stream-fd` but the daemon still parses them into a 32-bit `int`, so the handle can be truncated on 64-bit Windows and break IPC.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
|
@phazei please check Cubic. P0 and P1 need review |
Contributor
Author
I replied to the comments, I don't believe any changes are necessary. |
smpurkis
pushed a commit
to smpurkis/lucebox-hub
that referenced
this pull request
May 10, 2026
fix(pflash): support Windows in DflashClient
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
fix(pflash): support Windows in DflashClient
oliveagle
pushed a commit
to oliveagle/lucebox-hub
that referenced
this pull request
May 22, 2026
fix(pflash): support Windows in DflashClient
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.
The daemon-spawn path was POSIX-only. Three things break on Windows:
LD_LIBRARY_PATHis meaningless; Windows usesPATHfor DLL resolution.subprocess.Popen(pass_fds=...)is unsupported on Windows.--stream-fd, which on Windows must be a Win32 HANDLE (anint-castable handle value), not a CRT fd integer.Fixes:
sys.platform == "win32"branch when extending the loader search path. Theelsebranch is unchanged, so Linux behaviour is byte-identical to before.os.set_inheritable) and passmsvcrt.get_osfhandle(...)as--stream-fd. The daemon already accepts a HANDLE value here on Windows.close_fds=Falseso the child inherits the marked handle; on POSIX, keep the existingpass_fds=(self.w_pipe,)path.The pattern matches the in-process port already used in
dflash/scripts/server.py.