Skip to content

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 13, 2023

I have no idea what causes this issue but unless we code the path passed to @if exist then the commands within are echoed. This only happens when the path contains spaces, and only for the to commands within the @if exist.

The endless mystery of cmd.exe.

Fixes: #20913

@juj
Copy link
Collaborator

juj commented Dec 13, 2023

The endless mystery of cmd.exe.

Indeed. Unfortunately Microsoft has abandoned cmd.exe development (even though they could have had several ways to keep improving it in a 100% backwards compatible manner). It seems to be some kind of law of nature that in each OS, either the command line terminal or the file explorer/finder/viewer must suck.

Kind of a weird ask in this case, but would you be able to write a unit test for this case in other to make sure this stays fixed? (i.e. no extra newline will be generated) Given the super brittle and abandoned (but still 100% used everywhere) nature of Windows command prompt, it would be good to be very precise in the tests.

@sbc100 sbc100 force-pushed the fix_bat_files branch 7 times, most recently from 449f57a to 4d3536c Compare December 14, 2023 01:18
@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 14, 2023

Added test and verified that is fails without this change.

I have no idea what causes this issue but unless we code the path
passed to `@if exist` then the commands within are echoed.  This only
happens when the path contains spaces, and only for the to commands
within the `@if exist`.

The endless mystery of cmd.exe.

Fixes: emscripten-core#20913
@sbc100 sbc100 merged commit 9464cae into emscripten-core:main Dec 14, 2023
@sbc100 sbc100 deleted the fix_bat_files branch December 14, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emcc.bat prints out extra lines if emsdk is installed in path with spaces (HostOS: Windows)

2 participants