fix(dev): add Windows compatibility for mintlify subprocess #1902
+21
−9
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.
Overview
Fixes Windows compatibility issue where the
docs devcommand fails withFileNotFoundErrorwhen attempting to start the Mintlify development server. The issue occurs because Windows npm packages are installed as.CMDfiles which cannot be executed directly byasyncio.create_subprocess_exec.Type of change
Type: Fix bug
Additional notes
Problem:
When I was trying to run my local dev environment on Windows 11, the
docs devcommand failed with:After digging into the issue, I discovered that the script was attempting to run Mintlify as if it were a regular shell executable. On Windows, however, npm installs global packages like Mintlify as
.CMDbatch files rather than native executables. Because of this,asyncio.create_subprocess_execcannot directly execute .cmd batch files on Windows because they require a shell (cmd.exe) to interpret them.To address this, the solution was to adjust how subprocesses are created based on the operating system. On Windows,
create_subprocess_shellis used so the shell can properly interpret and run the.CMDfile. On Unix-based systems (Linux and macOS),create_subprocess_execis still used, since there is no need for invoking a shell. Platform detection is handled viasys.platform == "win32", which ensures the behavior is correct and consistent across environments.The fix works for my machine running Windows 11 using Python 3.13 and Git Bash (MINGW64). The Mintlify development server starts successfully, file watching and hot reloading work as expected.