Commit e0737cb
fix(dev): add Windows compatibility for mintlify subprocess (#1902)
## Overview
Fixes Windows compatibility issue where the `docs dev` command fails
with `FileNotFoundError` when attempting to start the Mintlify
development server. The issue occurs because Windows npm packages are
installed as `.CMD` files which cannot be executed directly by
`asyncio.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 dev` command failed with:
```
FileNotFoundError: [WinError 2] The system cannot find the file specified
```
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 `.CMD`
batch files rather than native executables. Because of this,
`asyncio.create_subprocess_exec` cannot 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_shell` is
used so the shell can properly interpret and run the `.CMD` file. On
Unix-based systems (Linux and macOS), `create_subprocess_exec` is still
used, since there is no need for invoking a shell. Platform detection is
handled via `sys.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.
---------
Co-authored-by: Lauren Hirata Singh <[email protected]>1 parent 5e2c094 commit e0737cb
1 file changed
+21
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
| |||
0 commit comments