Skip to content

Commit 9464cae

Browse files
authored
Fix for chatty bat files when path contains spaces (#20916)
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
1 parent e43f056 commit 9464cae

28 files changed

+34
-26
lines changed

Diff for: .circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ jobs:
828828
# windows and mac do not have separate build and test jobs, as they only run
829829
# a limited set of tests; it is simpler and faster to do it all in one job.
830830
test-windows:
831+
working_directory: "~/path with spaces"
831832
executor:
832833
name: win/vs2019
833834
shell: bash.exe -eo pipefail

Diff for: bootstrap.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: em++.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: em-config.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emar.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: embuilder.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emcc.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emcmake.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emconfigure.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emdump.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emdwp.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emmake.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emnm.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emprofile.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emranlib.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emrun.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emscons.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emsize.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emstrip.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: emsymbolizer.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: system/bin/sdl-config.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: system/bin/sdl2-config.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: test/runner.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: test/test_other.py

+7
Original file line numberDiff line numberDiff line change
@@ -3269,6 +3269,7 @@ def test_file_packager_depfile(self):
32693269
self.run_process([FILE_PACKAGER, 'test.data', '--js-output=test.js', '--depfile=test.data.d', '--from-emcc', '--preload', '.'])
32703270
output = read_file('test.data.d')
32713271
file_packager = utils.normalize_path(shared.replace_suffix(FILE_PACKAGER, '.py'))
3272+
file_packager = file_packager.replace(' ', '\\ ')
32723273
lines = output.splitlines()
32733274
split = lines.index(': \\')
32743275
before, after = set(lines[:split]), set(lines[split + 1:])
@@ -14322,3 +14323,9 @@ def test_embind_negative_enum_values(self):
1432214323
expected = '-1\n0\n1\n'
1432314324
self.do_run(src, expected_output=expected,
1432414325
emcc_args=['-lembind', '-sALLOW_MEMORY_GROWTH', '-sMAXIMUM_MEMORY=4GB'])
14326+
14327+
@crossplatform
14328+
def test_no_extra_output(self):
14329+
self.run_process([EMCC, '-c', test_file('hello_world.c')])
14330+
output = self.run_process([EMCC, '-c', test_file('hello_world.c')], stdout=PIPE, stderr=STDOUT).stdout
14331+
self.assertEqual(output, '')

Diff for: tools/file_packager.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: tools/maint/run_python.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: tools/maint/run_python_compiler.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

Diff for: tools/webidl_binder.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
2323
:: %~dp0 expansions will not work.
2424
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
25-
@if exist %~f0 (
25+
@if exist "%~f0" (
2626
set MYDIR=%~dp0
2727
goto FOUND_MYDIR
2828
)

0 commit comments

Comments
 (0)