fix(server): build the OpenAI server on Windows (MSVC)#28
Merged
Conversation
model_fetch.cpp included POSIX-only <sys/wait.h>/<unistd.h> and used fork/execvp/waitpid, so the Windows release build failed with 'Cannot open include file: sys/wait.h'. Add a Windows path using _spawnvp (_P_WAIT), which runs curl/wget directly without a shell, keeping the no-shell-injection property of the POSIX exec path. have_tool now uses 'where' on Windows and 'command -v' on POSIX. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 v0.3.0 release build failed on Windows:
examples/server/model_fetch.cppincluded POSIX-only<sys/wait.h>/<unistd.h>and usedfork/execvp/waitpid, so MSVC errored with:(
main.cppandopenai_format.cppalready compiled fine on MSVC; this was the only blocker.)Fix
Make the model fetcher cross-platform:
_spawnvp(_P_WAIT, ...)from<process.h>. Like the POSIXfork+execvppath, it launches the program directly with no shell, so the no-shell-injection property (URL/paths passed as literal argv entries) is preserved. Windows 10+ shipscurl.exe.have_tooluseswhereon Windows,command -von POSIX.#else).Test
PARAKEET_BUILD_SERVER=ON) still compiles;test_server_resolvepasses.