Description
I used Ninja support on Windows successfuly in the past, but it seems it got broken by #24111 and now results in lots of errors like:
FAILED: D:/emscripten/cache/build/libGL-getprocaddr/gl.o
D:\emscripten\emcc.bat -MD -MF D:/emscripten/cache/build/libGL-getprocaddr/gl.o.d -O2 -Wall -fno-unroll-loops -Oz -fno-inline-functions -g -sSTRICT -Werror -sRELOCATABLE -DEMSCRIPTEN_DYNAMIC_LINKING '-ffile-prefix-map=D:\emscripten=/emsdk/emscripten' '-ffile-prefix-map=..\..\..=/emsdk/emscripten' -fdebug-compilation-dir=/emsdk/emscripten -DMAX_WEBGL_VERSION=1 -DGL_ENABLE_GET_PROC_ADDRESS=1 -c D:/emscripten/system/lib/gl/gl.c -o D:/emscripten/cache/build/libGL-getprocaddr/gl.o
clang: error: no such file or directory: ''-ffile-prefix-map=D:\emscripten=/emsdk/emscripten''; did you mean '-ffile-prefix-map=D:\emscripten=/emsdk/emscripten''?
clang: error: no such file or directory: ''-ffile-prefix-map=..\..\..=/emsdk/emscripten''; did you mean '-ffile-prefix-map=..\..\..=/emsdk/emscripten''?
shlex.join
uses shlex.quote
under the hood, and as the warning on shlex.quote
docs says, it is only suitable for Unix shells:
Warning The shlex module is only designed for Unix shells.
The quote() function is not guaranteed to be correct on non-POSIX compliant shells or shells from other operating systems such as Windows. Executing commands quoted by this module on such shells can open up the possibility of a command injection vulnerability.
We worked around that issue by having a custom shlex_quote
implementation before, which worked correctly across different platforms by manually quoting arguments with double-quotes, and TBH I think we should just revert to doing that unless there is a simpler cross-platform solution.