@@ -15082,10 +15082,33 @@ def test_embind_negative_enum_values(self):
1508215082
1508315083 @crossplatform
1508415084 def test_no_extra_output(self):
15085+ # Run this build command first to warm the cache (since caching can produce stdout).
1508515086 self.run_process([EMCC, '-c', test_file('hello_world.c')])
1508615087 output = self.run_process([EMCC, '-c', test_file('hello_world.c')], stdout=PIPE, stderr=STDOUT).stdout
1508715088 self.assertEqual(output, '')
1508815089
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+
1508915112 def test_browser_too_old(self):
1509015113 err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMIN_CHROME_VERSION=10'])
1509115114 self.assertContained('emcc: error: MIN_CHROME_VERSION older than 74 is not supported', err)
0 commit comments