From 21f25339df9c6aa8c288297de73236e6aaa79582 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 6 Feb 2024 19:37:53 -0800 Subject: [PATCH] Fix `#preprocess` detection on windows (#21284) Followup to #21227 --- src/jsifier.js | 3 ++- test/test_other.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jsifier.js b/src/jsifier.js index fe02502e20d7..50a8256cc33a 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -98,7 +98,8 @@ function getTransitiveDeps(symbol) { } function shouldPreprocess(fileName) { - return read(fileName).trim().startsWith('#preprocess\n'); + var content = read(fileName).trim() + return content.startsWith('#preprocess\n') || content.startsWith('#preprocess\r\n'); } function preJS() { diff --git a/test/test_other.py b/test/test_other.py index 8b1387159e00..acc284d42c1b 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -14472,6 +14472,7 @@ def test_wasm64_no_asan(self): err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMEMORY64', '-fsanitize=address']) self.assertContained('error: MEMORY64 does not yet work with ASAN', err) + @crossplatform def test_js_preprocess_pre_post(self): create_file('pre.js', ''' #preprocess