diff --git a/emcc.py b/emcc.py index 15f7fc09d6e9..3ac8f3601cd3 100644 --- a/emcc.py +++ b/emcc.py @@ -1853,7 +1853,11 @@ def phase_linker_setup(options, state, newargs): # With this option we don't actually output the program itself only the # TS bindings. options.output_file = in_temp('a.out.js') + # Don't invoke the program's `main` function. settings.INVOKE_RUN = False + # Ignore -sMODULARIZE which could otherwise effect how we run the module + # to generate the bindings. + settings.MODULARIZE = False # options.output_file is the user-specified one, target is what we will generate if options.output_file: diff --git a/test/test_other.py b/test/test_other.py index 19bfbf9a41ec..e56f8b4bf2d0 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2908,8 +2908,11 @@ def test_jspi_add_function(self): self.do_runf(test_file('other/test_jspi_add_function.c'), 'done') def test_embind_tsgen(self): - self.run_process([EMCC, test_file('other/embind_tsgen.cpp'), '-o', 'out.html', - '-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts']) + # These extra arguments are not related to TS binding generation but we want to + # verify that they do not interfere with it. + extra_args = ['-o', 'out.html', '-sMODULARIZE'] + self.run_process([EMCC, test_file('other/embind_tsgen.cpp'), + '-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts'] + extra_args) actual = read_file('embind_tsgen.d.ts') self.assertNotExists('out.html') self.assertNotExists('out.js')