Skip to content

Commit 472768e

Browse files
committed
Add test for bat file quoting issue. NFC
See microsoft/terminal#15212
1 parent ec54193 commit 472768e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/test_other.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15079,10 +15079,33 @@ def test_embind_negative_enum_values(self):
1507915079

1508015080
@crossplatform
1508115081
def test_no_extra_output(self):
15082+
# Run this build command first to warm the cache (since caching can produce stdout).
1508215083
self.run_process([EMCC, '-c', test_file('hello_world.c')])
1508315084
output = self.run_process([EMCC, '-c', test_file('hello_world.c')], stdout=PIPE, stderr=STDOUT).stdout
1508415085
self.assertEqual(output, '')
1508515086

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+
# Specificaly 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 .bar 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+
1508615109
def test_browser_too_old(self):
1508715110
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMIN_CHROME_VERSION=10'])
1508815111
self.assertContained('emcc: error: MIN_CHROME_VERSION older than 74 is not supported', err)

0 commit comments

Comments
 (0)