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