@@ -15082,10 +15082,33 @@ def test_embind_negative_enum_values(self):
15082
15082
15083
15083
@crossplatform
15084
15084
def test_no_extra_output(self):
15085
+ # Run this build command first to warm the cache (since caching can produce stdout).
15085
15086
self.run_process([EMCC, '-c', test_file('hello_world.c')])
15086
15087
output = self.run_process([EMCC, '-c', test_file('hello_world.c')], stdout=PIPE, stderr=STDOUT).stdout
15087
15088
self.assertEqual(output, '')
15088
15089
15090
+ @crossplatform
15091
+ def test_shell_cmd_with_quotes(self):
15092
+ file = test_file('hello_world.c')
15093
+ # Run this build command first to warm the cache (since caching can produce stdout).
15094
+ self.run_process([EMCC, '-c', file])
15095
+
15096
+ # Verify that "emcc" is found in the PATH correctly in shell scripts (shell=True).
15097
+ # (Specifically when quotes are around the "emcc" command itself).
15098
+ # See https://github.com/microsoft/terminal/issues/15212
15099
+ old_path = os.environ['PATH']
15100
+ new_path = old_path + os.pathsep + os.path.dirname(EMCC)
15101
+ cmd = f'"emcc" -c "{file}"'
15102
+ print('running cmd:', cmd)
15103
+ with env_modify({'PATH': new_path}):
15104
+ proc = subprocess.run(cmd, capture_output=True, text=True, shell=True, check=True)
15105
+ # There is currently a bug in the windows .bat files that leads to stdout
15106
+ # not being empty in this case.
15107
+ # See https://github.com/emscripten-core/emscripten/pull/25416
15108
+ if not WINDOWS:
15109
+ self.assertEqual(proc.stdout, '')
15110
+ self.assertEqual(proc.stderr, '')
15111
+
15089
15112
def test_browser_too_old(self):
15090
15113
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMIN_CHROME_VERSION=10'])
15091
15114
self.assertContained('emcc: error: MIN_CHROME_VERSION older than 74 is not supported', err)
0 commit comments