Fix executable path with spaces breaking launch on Windows#2997
Fix executable path with spaces breaking launch on Windows#2997
Conversation
|
@copilot The changes made to |
Reverted the |
- setupInitScriptWindows.py: Replace os.execv() with subprocess.call() which properly handles paths with spaces by using a list of arguments instead of reconstructing a command line string. On Windows, os.execv() internally joins argv into a command line string, causing paths with spaces (e.g. "C:/Program Files/...") to be split incorrectly. Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com> Co-authored-by: cbentejac <11963329+cbentejac@users.noreply.github.com>
ab20c1b to
1bb3306
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2997 +/- ##
===========================================
+ Coverage 81.67% 82.01% +0.34%
===========================================
Files 69 69
Lines 9144 9310 +166
===========================================
+ Hits 7468 7636 +168
+ Misses 1676 1674 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
On Windows,
os.execv()reconstructs a command line by joining argv with spaces. When the executable lives under a path with spaces (e.g.C:\Program Files\Meshroom\), the path is split—C:\Programis treated as the executable andFiles\...as an argument.Replace
os.execv()withsubprocess.call()using a list, which invokesCreateProcessdirectly and handles quoting correctly.Features list
setupInitScriptWindows.pyto handle spaces in executable pathImplementation remarks
subprocess.call([sys.executable] + sys.argv[1:])passes arguments as a list, bypassing the broken command-line reconstruction thatos.execvdoes on Windows.sys.exit()wraps the call to preserve the exit code and prevent the rest of the init script from executing.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.