Skip to content

Fix emrun with EXIT_RUNTIME=0 #24944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,6 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
options.post_js.append(utils.path_from_root('src/emrun_postjs.js'))
if settings.MINIMAL_RUNTIME:
exit_with_error('--emrun is not compatible with MINIMAL_RUNTIME')
# emrun mode waits on program exit
if user_settings.get('EXIT_RUNTIME') == '0':
exit_with_error('--emrun is not compatible with EXIT_RUNTIME=0')
settings.EXIT_RUNTIME = 1
Copy link
Collaborator

@sbc100 sbc100 Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait.. shouldn't we also delete this line then?

The reason for the above error is that we are about to set -sEXIT_RUNTIME=1 .. so if the user explicitly asks for -sEXIT_RUNTIME=0 then that is a contradiction.

How about we change the above error into a warnings: warning: ignoring -sEXIT_RUNTIME=0 because --emrun used.

What I'm trying to avoid is having emcc silently ignore the user's command line settings (or at least tell the user when two settings contradict each other, as in this case).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, the line settings.EXIT_RUNTIME = 1 will override user's command line if user passes emcc --emrun -sEXIT_RUNTIME=0. Hmm that's not good.

Actually I'm now confused how wasm_webgpu test suite was working with that line 740 with settings.EXIT_RUNTIME = 1 in place. Or maybe the user command line setting is applied only afterwards, so line 740 won't override it?

# emrun_postjs.js needs this library function.
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += ['$addOnExit']
Expand Down